diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index ecc7957b797..074b4105215 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -3463,14 +3463,15 @@ if ($action == 'create') { if (empty($reshook)) { if ($action != 'editline') { // Subtotal - if ($object->status == Propal::STATUS_DRAFT && isModEnabled('subtotals') && getDolGlobalString('SUBTOTAL_TITLE_'.strtoupper($object->element))) { + if ($object->status == Propal::STATUS_DRAFT && isModEnabled('subtotals') + && (getDolGlobalInt('SUBTOTAL_TITLE_'.strtoupper($object->element)) || getDolGlobalInt('SUBTOTAL_'.strtoupper($object->element)))) { $langs->load('subtotals'); $url_button = array(); $url_button[] = array( 'lang' => 'subtotals', - 'enabled' => (isModEnabled('propal') && $object->status == Propal::STATUS_DRAFT), + 'enabled' => (isModEnabled('propal') && $object->status == Propal::STATUS_DRAFT && getDolGlobalInt('SUBTOTAL_TITLE_'.strtoupper($object->element))), 'perm' => (bool) $usercancreate, 'label' => $langs->trans('AddTitleLine'), 'url' => '/comm/propal/card.php?id='.$object->id.'&action=add_title_line&token='.newToken() @@ -3478,7 +3479,7 @@ if ($action == 'create') { $url_button[] = array( 'lang' => 'subtotals', - 'enabled' => (isModEnabled('propal') && $object->status == Propal::STATUS_DRAFT), + 'enabled' => (isModEnabled('propal') && $object->status == Propal::STATUS_DRAFT && getDolGlobalInt('SUBTOTAL_'.strtoupper($object->element))), 'perm' => (bool) $usercancreate, 'label' => $langs->trans('AddSubtotalLine'), 'url' => '/comm/propal/card.php?id='.$object->id.'&action=add_subtotal_line&token='.newToken() diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 25fc87772b5..b67dc1ccbbc 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -3445,14 +3445,15 @@ if ($action == 'create' && $usercancreate) { } // Subtotal - if ($object->status == Commande::STATUS_DRAFT && isModEnabled('subtotals') && getDolGlobalString('SUBTOTAL_TITLE_'.strtoupper($object->element))) { + if ($object->status == Commande::STATUS_DRAFT && isModEnabled('subtotals') + && (getDolGlobalInt('SUBTOTAL_TITLE_'.strtoupper($object->element)) || getDolGlobalInt('SUBTOTAL_'.strtoupper($object->element)))) { $langs->load('subtotals'); $url_button = array(); $url_button[] = array( 'lang' => 'subtotals', - 'enabled' => (isModEnabled('order') && $object->status == Commande::STATUS_DRAFT), + 'enabled' => (isModEnabled('order') && $object->status == Commande::STATUS_DRAFT && getDolGlobalInt('SUBTOTAL_TITLE_'.strtoupper($object->element))), 'perm' => (bool) $usercancreate, 'label' => $langs->trans('AddTitleLine'), 'url' => '/commande/card.php?id='.$object->id.'&action=add_title_line&token='.newToken() @@ -3460,7 +3461,7 @@ if ($action == 'create' && $usercancreate) { $url_button[] = array( 'lang' => 'subtotals', - 'enabled' => (isModEnabled('order') && $object->status == Commande::STATUS_DRAFT), + 'enabled' => (isModEnabled('order') && $object->status == Commande::STATUS_DRAFT && getDolGlobalInt('SUBTOTAL_'.strtoupper($object->element))), 'perm' => (bool) $usercancreate, 'label' => $langs->trans('AddSubtotalLine'), 'url' => '/commande/card.php?id='.$object->id.'&action=add_subtotal_line&token='.newToken() diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index d342afd0fed..687a10d0f32 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -2076,14 +2076,15 @@ if ($action == 'create') { ); // Subtotal - if (empty($object->suspended) && isModEnabled('subtotals') && getDolGlobalString('SUBTOTAL_TITLE_'.strtoupper($object->element))) { + if (empty($object->suspended) && isModEnabled('subtotals') + && (getDolGlobalInt('SUBTOTAL_TITLE_'.strtoupper($object->element)) || getDolGlobalInt('SUBTOTAL_'.strtoupper($object->element)))) { $langs->load("subtotals"); $url_button = array(); $url_button[] = array( 'lang' => 'subtotals', - 'enabled' => (isModEnabled('invoice') && $object->status == Facture::STATUS_DRAFT), + 'enabled' => (isModEnabled('invoice') && $object->status == Facture::STATUS_DRAFT && getDolGlobalInt('SUBTOTAL_TITLE_'.strtoupper($object->element))), 'perm' => (bool) $usercancreate, 'label' => $langs->trans('AddTitleLine'), 'url' => '/compta/facture/card-rec.php?id='.$object->id.'&action=add_title_line&token='.newToken() @@ -2091,7 +2092,7 @@ if ($action == 'create') { $url_button[] = array( 'lang' => 'subtotals', - 'enabled' => (isModEnabled('invoice') && $object->status == Facture::STATUS_DRAFT), + 'enabled' => (isModEnabled('invoice') && $object->status == Facture::STATUS_DRAFT && getDolGlobalInt('SUBTOTAL_'.strtoupper($object->element))), 'perm' => (bool) $usercancreate, 'label' => $langs->trans('AddSubtotalLine'), 'url' => '/compta/facture/card-rec.php?id='.$object->id.'&action=add_subtotal_line&token='.newToken() diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index d83c4b4fb0e..41f1f015c84 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -6390,14 +6390,15 @@ if ($action == 'create') { } // Subtotal - if ($object->status == Facture::STATUS_DRAFT && isModEnabled('subtotals') && getDolGlobalString('SUBTOTAL_TITLE_'.strtoupper($object->element))) { + if ($object->status == Facture::STATUS_DRAFT && isModEnabled('subtotals') + && (getDolGlobalInt('SUBTOTAL_TITLE_'.strtoupper($object->element)) || getDolGlobalInt('SUBTOTAL_'.strtoupper($object->element)))) { $langs->load("subtotals"); $url_button = array(); $url_button[] = array( 'lang' => 'subtotals', - 'enabled' => (isModEnabled('invoice') && $object->status == Facture::STATUS_DRAFT), + 'enabled' => (isModEnabled('invoice') && $object->status == Facture::STATUS_DRAFT && getDolGlobalInt('SUBTOTAL_TITLE_'.strtoupper($object->element))), 'perm' => (bool) $usercancreate, 'label' => $langs->trans('AddTitleLine'), 'url' => '/compta/facture/card.php?facid='.$object->id.'&action=add_title_line&token='.newToken() @@ -6405,7 +6406,7 @@ if ($action == 'create') { $url_button[] = array( 'lang' => 'subtotals', - 'enabled' => (isModEnabled('invoice') && $object->status == Facture::STATUS_DRAFT), + 'enabled' => (isModEnabled('invoice') && $object->status == Facture::STATUS_DRAFT && getDolGlobalInt('SUBTOTAL_'.strtoupper($object->element))), 'perm' => (bool) $usercancreate, 'label' => $langs->trans('AddSubtotalLine'), 'url' => '/compta/facture/card.php?facid='.$object->id.'&action=add_subtotal_line&token='.newToken()