diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index a2e43570545..b8b9b4fe6a6 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -34,13 +34,11 @@ require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/fichinter/modules_fichinter.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - if (! empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } - if ($conf->contrat->enabled) { require_once DOL_DOCUMENT_ROOT."/core/class/html.formcontract.class.php"; @@ -612,6 +610,21 @@ if (empty($reshook)) } } + // Classify Billed + else if ($action == 'classifydone' && $user->rights->ficheinter->creer) + { + $result=$object->setStatut(3); + if ($result > 0) + { + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + /* * Mise a jour d'une ligne d'intervention */ @@ -842,8 +855,8 @@ if (empty($reshook)) $form = new Form($db); $formfile = new FormFile($db); -if ($conf->contrat->enabled) - $formcontract = new FormContract($db); +if ($conf->contrat->enabled) $formcontract = new FormContract($db); +if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } llxHeader('',$langs->trans("Intervention")); @@ -1090,7 +1103,7 @@ else if ($id > 0 || ! empty($ref)) { /* * Affichage en mode visu - */ + */ $object->fetch($id, $ref); $object->fetch_thirdparty(); @@ -1172,59 +1185,104 @@ else if ($id > 0 || ! empty($ref)) // Print form confirm print $formconfirm; - print ''; - + + // Intervention card $linkback = ''.$langs->trans("BackToList").''; - + + + $morehtmlref='
'; + // Ref customer + //$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1); + //$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->commande->creer) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + + print '
'; + // Ref + /* print ''; // Third party print ""; - - if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) - { - // Duration - print ''; - print ''; - print ''; - } - + */ + if (! empty($conf->global->FICHINTER_USE_PLANNED_AND_DONE_DATES)) { // Date Start - print ''; - print ''; + print ''; print ''; // Date End print ''; - print ''; print ''; // Date Terminate/close print ''; - print ''; print ''; } // Description (must be a textarea and not html must be allowed (used in list view) - print ''; print ''; // Project + /* if (! empty($conf->projet->enabled)) { $langs->load('projects'); @@ -1252,7 +1310,7 @@ else if ($id > 0 || ! empty($ref)) } print ''; print ''; - } + }*/ // Contrat if ($conf->contrat->enabled) @@ -1271,7 +1329,7 @@ else if ($id > 0 || ! empty($ref)) print ''; } print '
'.$langs->trans("Ref").''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); print '
".$langs->trans("Company").''.$object->thirdparty->getNomUrl(1)."
'.$langs->trans("TotalDuration").''.convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'
'.$langs->trans("Dateo").''; + print '
'.$langs->trans("Dateo").''; print $object->dateo ? dol_print_date($object->dateo, 'daytext') : ' '; print '
'.$langs->trans("Datee").''; + print ''; print $object->datee ? dol_print_date($object->datee, 'daytext') : ' '; print '
'.$langs->trans("Datet").''; + print ''; print $object->datet ? dol_print_date($object->datet, 'daytext') : ' '; print '
'; + print '
'; print $form->editfieldkey("Description",'description',$object->description,$object,$user->rights->ficheinter->creer,'textarea'); - print ''; + print ''; print $form->editfieldval("Description",'description',$object->description,$object,$user->rights->ficheinter->creer,'textarea:8:80'); print '
'; - print ''; + print ''; if ($action == 'contrat') { $formcontract= new Formcontract($db); @@ -1296,13 +1354,37 @@ else if ($id > 0 || ! empty($ref)) } // Statut - print ''.$langs->trans("Status").''.$object->getLibStatut(4).''; + //print ''.$langs->trans("Status").''.$object->getLibStatut(4).''; // Other attributes - $cols = 3; + $cols = 2; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + print ''; + + print ''; + print '
'; + print '
'; + print '
'; + + print ''; + + if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) + { + // Duration + print ''; + print ''; + print ''; + } + print "
'.$langs->trans("TotalDuration").''.convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'
"; + + print '
'; + print '
'; + print ''; + + print '

'; + if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { @@ -1635,7 +1717,7 @@ else if ($id > 0 || ! empty($ref)) else print '
'.$langs->trans("AddBill").'
'; } - if (! empty($conf->global->FICHINTER_CLASSIFY_BILLED)) + if (! empty($conf->global->FICHINTER_CLASSIFY_BILLED)) // Option deprecated. In a future, billed must be managed with a dedicated field to 0 or 1 { if ($object->statut != 2) { @@ -1648,6 +1730,12 @@ else if ($id > 0 || ! empty($ref)) } } + // Done + if (empty($conf->global->FICHINTER_CLASSIFY_BILLED) && $object->statut > 0 && $object->statut < 3) + { + print '
'.$langs->trans("InterventionClassifyDone").'
'; + } + // Clone if ($user->rights->ficheinter->creer) { print '
' . $langs->trans("ToClone") . '
'; diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 54d5dc05c33..acbc6b24083 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -38,7 +38,8 @@ class Fichinter extends CommonObject public $table_element='fichinter'; public $fk_element='fk_fichinter'; public $table_element_line='fichinterdet'; - + public $picto = 'intervention'; + /** * {@inheritdoc} */ @@ -78,15 +79,15 @@ class Fichinter extends CommonObject $this->statuts[0]='Draft'; $this->statuts[1]='Validated'; $this->statuts[2]='StatusInterInvoiced'; - $this->statuts[3]='Close'; + $this->statuts[3]='Done'; $this->statuts_short[0]='Draft'; $this->statuts_short[1]='Validated'; $this->statuts_short[2]='StatusInterInvoiced'; - $this->statuts_short[3]='Close'; + $this->statuts_short[3]='Done'; $this->statuts_logo[0]='statut0'; $this->statuts_logo[1]='statut1'; $this->statuts_logo[2]='statut6'; - $this->statuts_logo[3]='statut4'; + $this->statuts_logo[3]='statut6'; } /** @@ -552,7 +553,7 @@ class Fichinter extends CommonObject * Returns the label of a statut * * @param int $statut id statut - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ function LibStatut($statut,$mode=0) @@ -561,22 +562,20 @@ class Fichinter extends CommonObject if ($mode == 0) return $langs->trans($this->statuts[$statut]); - if ($mode == 1) return $langs->trans($this->statuts_short[$statut]); - if ($mode == 2) return img_picto($langs->trans($this->statuts_short[$statut]), $this->statuts_logo[$statut]).' '.$langs->trans($this->statuts_short[$statut]); - if ($mode == 3) return img_picto($langs->trans($this->statuts_short[$statut]), $this->statuts_logo[$statut]); - if ($mode == 4) return img_picto($langs->trans($this->statuts_short[$statut]),$this->statuts_logo[$statut]).' '.$langs->trans($this->statuts[$statut]); - if ($mode == 5) - return ''.$langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),$this->statuts_logo[$statut]); - + return ''.$langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),$this->statuts_logo[$statut]); + if ($mode == 6) + return ''.$langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),$this->statuts_logo[$statut]); + + return ''; } /** diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 3118bb819cf..86d9902954c 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -356,6 +356,7 @@ if ($result) { print ''; $liststatus=$objectstatic->statuts_short; + if (empty($conf->global->FICHINTER_CLASSIFY_BILLED)) unset($liststatus[2]); // Option deprecated. In a future, billed must be managed with a dedicated field to 0 or 1 print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 1); print ''; }