From e3d94d44ab03fab2040152ce09113805eb287bf3 Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Tue, 16 Jun 2020 10:30:10 +0200 Subject: [PATCH] NEW hide closed contract lines --- htdocs/admin/contract.php | 12 +++++++++++- htdocs/contrat/card.php | 22 +++++++++++++++------- htdocs/langs/en_US/contracts.lang | 3 +++ htdocs/langs/fr_FR/contracts.lang | 3 +++ 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index 474227349b8..f07011f4968 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -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 ''; print ''; print ''."\n"; +print ''; +print ''.$langs->trans("HideClosedServiceByDefault").''; +print ''; +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 ''; +print ''; + print ''; print '
'; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index c4f923a7372..9693ee2a7a6 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1490,7 +1490,9 @@ if ($action == 'create') // Line in view mode if ($action != 'editline' || GETPOST('rowid') != $objp->rowid) { - print ''; + $moreparam = ''; + if (! empty($conf->global->CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT) && $objp->statut == ContratLigne::STATUS_CLOSED && $action != 'showclosedlines') $moreparam = 'style="display: none;"'; + print ''; // Label if ($objp->fk_product > 0) { @@ -1586,7 +1588,7 @@ if ($action == 'create') $colspan = 7; } - print ''; + print ''; print ''; // 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 ''; + $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 ''; print '
'; print "\n"; } @@ -1797,7 +1801,7 @@ if ($action == 'create') { print ''; - print ''; + print ''; print ''; print ''; print "\n"; - print ''; + print ''; print '
'.$langs->trans("ServiceStatus").': '.$object->lines[$cursorline - 1]->getLibStatut(4).''; if ($user->socid == 0) @@ -1824,7 +1828,7 @@ if ($action == 'create') print '
'; // Si pas encore active @@ -2082,7 +2086,11 @@ if ($action == 'create') // print ''; //} } - + if (! empty($conf->global->CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT) && $object->nbofservicesclosed > 0) + { + if($action == 'showclosedlines') print ''; + else print ''; + } // On peut supprimer entite si // - Droit de creer + mode brouillon (erreur creation) // - Droit de supprimer diff --git a/htdocs/langs/en_US/contracts.lang b/htdocs/langs/en_US/contracts.lang index 47572c355ab..373d68c16b1 100644 --- a/htdocs/langs/en_US/contracts.lang +++ b/htdocs/langs/en_US/contracts.lang @@ -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 \ No newline at end of file diff --git a/htdocs/langs/fr_FR/contracts.lang b/htdocs/langs/fr_FR/contracts.lang index 2372c9bec3f..e1dc3103151 100644 --- a/htdocs/langs/fr_FR/contracts.lang +++ b/htdocs/langs/fr_FR/contracts.lang @@ -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 \ No newline at end of file