Skip to content

Commit

Permalink
Qual create button to factorize services buttons in ficheinter/card.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Hystepik committed Sep 20, 2024
1 parent 84e5f5e commit 48437ed
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions htdocs/fichinter/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -1773,27 +1773,32 @@
print '</div>';
}

$arrayofcreatebutton = array();
// Proposal
if (isModEnabled("service") && isModEnabled("propal") && $object->statut > Fichinter::STATUS_DRAFT) {
$langs->load("propal");
if ($object->statut < Fichinter::STATUS_BILLED) {
if ($user->hasRight('propal', 'creer')) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddProp").'</a></div>';
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("AddProp").'</a></div>';
}
$arrayofcreatebutton[] = array(
'url' => '/comm/propal/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid,
'label' => $langs->trans('AddProp'),
'lang' => 'propal',
'perm' => $user->hasRight('propal', 'creer'),
'enabled' => true,
);
}
}

// Invoicing
if (isModEnabled('invoice') && $object->statut > Fichinter::STATUS_DRAFT) {
$langs->load("bills");
if ($object->statut < Fichinter::STATUS_BILLED) {
if ($user->hasRight('facture', 'creer')) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddBill").'</a></div>';
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("AddBill").'</a></div>';
}
$arrayofcreatebutton[] = array(
'url' => '/compta/facture/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid,
'label' => $langs->trans('AddBill'),
'lang' => 'bills',
'perm' => $user->hasRight('facture', 'creer'),
'enabled' => true,
);
}

if (getDolGlobalString('FICHINTER_CLASSIFY_BILLED')) { // Option deprecated. In a future, billed must be managed with a dedicated field to 0 or 1
Expand All @@ -1805,6 +1810,10 @@
}
}

if (count($arrayofcreatebutton)) {
print dolGetButtonAction('', $langs->trans("Create"), 'default', $arrayofcreatebutton, '', true, $params);

Check warning on line 1814 in htdocs/fichinter/card.php

View workflow job for this annotation

GitHub Actions / phan / Run phan

card.php: PhanUndeclaredGlobalVariable: Global variable $params is undeclared
}

// Sign
if ($object->statut > Fichinter::STATUS_DRAFT) {
if ($object->signed_status != Fichinter::$SIGNED_STATUSES['STATUS_SIGNED_ALL']) {
Expand Down

0 comments on commit 48437ed

Please sign in to comment.