Qual create button to factorize services buttons in ficheinter/card.php (#31065)

* Qual create button to factorize services buttons in ficheinter/card.php

* Fix Ci

---------

Co-authored-by: Hystepik <lmarcouiller@nltechno.com>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
Lucas Marcouiller 2024-09-26 21:36:49 +02:00 committed by GitHub
parent 7127f444f4
commit e736235a30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1726,6 +1726,7 @@ if ($action == 'create') {
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
if (empty($reshook)) {
$params = array();
if ($user->socid == 0) {
if ($action != 'editdescription' && ($action != 'presend')) {
// Validate
@ -1775,15 +1776,18 @@ if ($action == 'create') {
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,
);
}
}
@ -1791,11 +1795,13 @@ if ($action == 'create') {
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
@ -1807,6 +1813,10 @@ if ($action == 'create') {
}
}
if (count($arrayofcreatebutton)) {
print dolGetButtonAction('', $langs->trans("Create"), 'default', $arrayofcreatebutton, '', true, $params);
}
// Sign
if ($object->statut > Fichinter::STATUS_DRAFT) {
if ($object->signed_status != Fichinter::$SIGNED_STATUSES['STATUS_SIGNED_ALL']) {