Merge pull request #36523 from FHenry/22_fix_subtotal_feature
FIX: subtotal feature button availablity according setup
This commit is contained in:
commit
23db225ec3
4 changed files with 16 additions and 12 deletions
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in a new issue