NEW Add status Done on interventions
This commit is contained in:
parent
af28a67803
commit
5602bcd440
@ -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 '<table class="border" width="100%">';
|
||||
|
||||
|
||||
// Intervention card
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// 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.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->commande->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} 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.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
/*
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
|
||||
print '</td></tr>';
|
||||
|
||||
// Third party
|
||||
print "<tr><td>".$langs->trans("Company").'</td><td colspan="3">'.$object->thirdparty->getNomUrl(1)."</td></tr>";
|
||||
|
||||
if (empty($conf->global->FICHINTER_DISABLE_DETAILS))
|
||||
{
|
||||
// Duration
|
||||
print '<tr><td>'.$langs->trans("TotalDuration").'</td>';
|
||||
print '<td colspan="3">'.convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
if (! empty($conf->global->FICHINTER_USE_PLANNED_AND_DONE_DATES))
|
||||
{
|
||||
// Date Start
|
||||
print '<tr><td>'.$langs->trans("Dateo").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Dateo").'</td>';
|
||||
print '<td>';
|
||||
print $object->dateo ? dol_print_date($object->dateo, 'daytext') : ' ';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date End
|
||||
print '<tr><td>'.$langs->trans("Datee").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print '<td>';
|
||||
print $object->datee ? dol_print_date($object->datee, 'daytext') : ' ';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date Terminate/close
|
||||
print '<tr><td>'.$langs->trans("Datet").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print '<td>';
|
||||
print $object->datet ? dol_print_date($object->datet, 'daytext') : ' ';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Description (must be a textarea and not html must be allowed (used in list view)
|
||||
print '<tr><td>';
|
||||
print '<tr><td class="titlefield">';
|
||||
print $form->editfieldkey("Description",'description',$object->description,$object,$user->rights->ficheinter->creer,'textarea');
|
||||
print '</td><td colspan="3">';
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("Description",'description',$object->description,$object,$user->rights->ficheinter->creer,'textarea:8:80');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Project
|
||||
/*
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load('projects');
|
||||
@ -1252,7 +1310,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}*/
|
||||
|
||||
// Contrat
|
||||
if ($conf->contrat->enabled)
|
||||
@ -1271,7 +1329,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
print '</td><td>';
|
||||
if ($action == 'contrat')
|
||||
{
|
||||
$formcontract= new Formcontract($db);
|
||||
@ -1296,13 +1354,37 @@ else if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
|
||||
// Statut
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$object->getLibStatut(4).'</td></tr>';
|
||||
//print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$object->getLibStatut(4).'</td></tr>';
|
||||
|
||||
// Other attributes
|
||||
$cols = 3;
|
||||
$cols = 2;
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
if (empty($conf->global->FICHINTER_DISABLE_DETAILS))
|
||||
{
|
||||
// Duration
|
||||
print '<tr><td class="titlefield">'.$langs->trans("TotalDuration").'</td>';
|
||||
print '<td>'.convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="clearboth"></div><br>';
|
||||
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
@ -1635,7 +1717,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("AddBill").'</a></div>';
|
||||
}
|
||||
|
||||
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 '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifydone">'.$langs->trans("InterventionClassifyDone").'</a></div>';
|
||||
}
|
||||
|
||||
// Clone
|
||||
if ($user->rights->ficheinter->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&socid=' . $object->socid . '&action=clone&object=ficheinter">' . $langs->trans("ToClone") . '</a></div>';
|
||||
|
||||
@ -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 '<span class="hideonsmartphone">'.$langs->trans($this->statuts_short[$statut]).' </span>'.img_picto($langs->trans($this->statuts_short[$statut]),$this->statuts_logo[$statut]);
|
||||
|
||||
return '<span class="hideonsmartphone">'.$langs->trans($this->statuts_short[$statut]).' </span>'.img_picto($langs->trans($this->statuts[$statut]),$this->statuts_logo[$statut]);
|
||||
if ($mode == 6)
|
||||
return '<span class="hideonsmartphone">'.$langs->trans($this->statuts[$statut]).' </span>'.img_picto($langs->trans($this->statuts[$statut]),$this->statuts_logo[$statut]);
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -356,6 +356,7 @@ if ($result)
|
||||
{
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$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 '</td>';
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user