NEW hide closed contract lines

This commit is contained in:
atm-quentin 2020-06-16 10:30:10 +02:00
parent 9ec8051a37
commit e3d94d44ab
4 changed files with 32 additions and 8 deletions

View File

@ -149,7 +149,10 @@ elseif ($action == 'setdoc')
$draft = GETPOST('CONTRACT_DRAFT_WATERMARK', 'alpha');
$res2 = dolibarr_set_const($db, "CONTRACT_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
if (!$res1 > 0 || !$res2 > 0) $error++;
$value = GETPOST('activate_hideClosedServiceByDefault', 'alpha');
$res3 = dolibarr_set_const($db, "CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT", $value, 'chaine', 0, '', $conf->entity);
if (!$res1 > 0 || !$res2 > 0 || !$res3 > 0) $error++;
if (!$error)
{
@ -470,6 +473,13 @@ print '</td><td>';
print '<input size="50" class="flat" type="text" name="CONTRACT_DRAFT_WATERMARK" value="'.$conf->global->CONTRACT_DRAFT_WATERMARK.'">';
print '</td></tr>'."\n";
print '<tr class="oddeven">';
print '<td>'.$langs->trans("HideClosedServiceByDefault").'</td>';
print '<td width="60" class="right">';
print $form->selectyesno("activate_hideClosedServiceByDefault", (! empty($conf->global->CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT)?$conf->global->CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT:0), 1);
print '</td>';
print '</tr>';
print '</table>';
print '<div class="center">';

View File

@ -1490,7 +1490,9 @@ if ($action == 'create')
// Line in view mode
if ($action != 'editline' || GETPOST('rowid') != $objp->rowid)
{
print '<tr class="tdtop oddeven">';
$moreparam = '';
if (! empty($conf->global->CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT) && $objp->statut == ContratLigne::STATUS_CLOSED && $action != 'showclosedlines') $moreparam = 'style="display: none;"';
print '<tr class="tdtop oddeven" '.$moreparam.'>';
// Label
if ($objp->fk_product > 0)
{
@ -1586,7 +1588,7 @@ if ($action == 'create')
$colspan = 7;
}
print '<tr class="oddeven">';
print '<tr class="oddeven" '.$moreparam.'>';
print '<td colspan="'.$colspan.'">';
// Date planned
@ -1622,7 +1624,7 @@ if ($action == 'create')
$line = new ContratLigne($db);
$line->id = $objp->rowid;
$line->fetch_optionals();
print $line->showOptionals($extrafields, 'view', array('style'=>'class="oddeven"', 'colspan'=>$colspan), '', '', 1);
print $line->showOptionals($extrafields, 'view', array('class'=>'oddeven','style'=>$moreparam, 'colspan'=>$colspan), '', '', 1);
}
}
// Line in mode update
@ -1721,7 +1723,9 @@ if ($action == 'create')
if ($object->statut > 0)
{
print '<tr class="oddeven">';
$moreparam = '';
if (! empty($conf->global->CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT) && $object->lines[$cursorline-1]->statut == ContratLigne::STATUS_CLOSED && $action != 'showclosedlines') $moreparam = 'style="display: none;"';
print '<tr class="oddeven" '.$moreparam.'>';
print '<td class="tdhrthin" colspan="'.($conf->margin->enabled ? 7 : 6).'"><hr class="opacitymedium tdhrthin"></td>';
print "</tr>\n";
}
@ -1797,7 +1801,7 @@ if ($action == 'create')
{
print '<table class="notopnoleftnoright tableforservicepart2'.($cursorline < $nbofservices ? ' boxtablenobottom' : '').'" width="100%">';
print '<tr class="oddeven">';
print '<tr class="oddeven" '.$moreparam.'>';
print '<td>'.$langs->trans("ServiceStatus").': '.$object->lines[$cursorline - 1]->getLibStatut(4).'</td>';
print '<td width="30" class="right">';
if ($user->socid == 0)
@ -1824,7 +1828,7 @@ if ($action == 'create')
print '</td>';
print "</tr>\n";
print '<tr class="oddeven">';
print '<tr class="oddeven" '.$moreparam.'>';
print '<td>';
// Si pas encore active
@ -2082,7 +2086,11 @@ if ($action == 'create')
// print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("CloseRefusedBecauseOneServiceActive").'">'.$langs->trans("Close").'</a></div>';
//}
}
if (! empty($conf->global->CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT) && $object->nbofservicesclosed > 0)
{
if($action == 'showclosedlines') print '<div class="inline-block divButAction"><a class="butAction" id="btnhideclosedlines" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=hideclosedlines">'.$langs->trans("HideClosedServices").'</a></div>';
else print '<div class="inline-block divButAction"><a class="butAction" id="btnshowclosedlines" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=showclosedlines">'.$langs->trans("ShowClosedServices").'</a></div>';
}
// On peut supprimer entite si
// - Droit de creer + mode brouillon (erreur creation)
// - Droit de supprimer

View File

@ -99,3 +99,6 @@ TypeContact_contrat_internal_SALESREPFOLL=Sales representative following-up cont
TypeContact_contrat_external_BILLING=Billing customer contact
TypeContact_contrat_external_CUSTOMER=Follow-up customer contact
TypeContact_contrat_external_SALESREPSIGN=Signing contract customer contact
HideClosedServiceByDefault=Hide closed services by default
ShowClosedServices=Show Closed Services
HideClosedServices=Hide Closed Services

View File

@ -99,3 +99,6 @@ TypeContact_contrat_internal_SALESREPFOLL=Commercial suivi du contrat
TypeContact_contrat_external_BILLING=Contact client facturation contrat
TypeContact_contrat_external_CUSTOMER=Contact client suivi contrat
TypeContact_contrat_external_SALESREPSIGN=Contact client signataire contrat
HideClosedServiceByDefault=Cacher les services fermés sur les contrats par défaut
ShowClosedServices=Afficher les services fermés
HideClosedServices=Cacher les services fermés