diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 65aa707547c..dac92bf8e81 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -5311,6 +5311,12 @@ if ($action == 'create') {
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
+ $params = array(
+ 'attr' => array(
+ 'title' => '',
+ 'class' => 'classfortooltip'
+ )
+ );
// Editer une facture deja validee, sans paiement effectue et pas exporte en compta
if ($object->statut == Facture::STATUS_VALIDATED) {
// We check if lines of invoice are not already transfered into accountancy
@@ -5320,18 +5326,22 @@ if ($action == 'create') {
if (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_EDITED) || ($resteapayer == price2num($object->total_ttc, 'MT', 1) && empty($object->paye))) {
if (!$objectidnext && $object->is_last_in_cycle()) {
if ($usercanunvalidate) {
- print ''.$langs->trans('Modify').'';
+ print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=modif', '', true, $params);
} else {
- print ''.$langs->trans('Modify').'';
+ $params['attr']['title'] = $langs->trans('NotEnoughPermissions');
+ print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=modif', '', false, $params);
}
} elseif (!$object->is_last_in_cycle()) {
- print ''.$langs->trans('Modify').'';
+ $params['attr']['title'] = $langs->trans('NotLastInCycle');
+ print dolGetButtonAction($langs->trans('Modify'), '', 'default', '#', '', false, $params);
} else {
- print ''.$langs->trans('Modify').'';
+ $params['attr']['title'] = $langs->trans('DisabledBecauseReplacedInvoice');
+ print dolGetButtonAction($langs->trans('Modify'), '', 'default', '#', '', false, $params);
}
}
} else {
- print ''.$langs->trans('Modify').'';
+ $params['attr']['title'] = $langs->trans('DisabledBecauseDispatchedInBookkeeping');
+ print dolGetButtonAction($langs->trans('Modify'), '', 'default', '#', '', false, $params);
}
}
@@ -5346,9 +5356,10 @@ if ($action == 'create') {
&& ($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED || ($object->statut == 1 && $object->paye == 1)) // Condition ($object->statut == 1 && $object->paye == 1) should not happened but can be found due to corrupted data
&& ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || $usercanreopen)) { // A paid invoice (partially or completely)
if ($object->close_code != 'replaced' || (!$objectidnext)) { // Not replaced by another invoice or replaced but the replacement invoice has been deleted
- print ''.$langs->trans('ReOpen').'';
+ print dolGetButtonAction($langs->trans('ReOpen'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=reopen&token='.newToken(), '', true, $params);
} else {
- print ''.$langs->trans('ReOpen').'';
+ $params['attr']['title'] = $langs->trans("DisabledBecauseReplacedInvoice");
+ print dolGetButtonAction($langs->trans('ReOpen'), '', 'default', '#', '', false, $params);
}
}
@@ -5366,7 +5377,7 @@ if ($action == 'create') {
// Validate
if ($object->statut == Facture::STATUS_DRAFT && count($object->lines) > 0 && ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) && (!empty($conf->global->FACTURE_ENABLE_NEGATIVE) || $object->total_ttc >= 0)) || ($object->type == Facture::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) {
if ($usercanvalidate) {
- print 'id.'&action=valid&token='.newToken().'">'.$langs->trans('Validate').'';
+ print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=valid&token='.newToken(), '', true, $params);
}
}
@@ -5377,9 +5388,9 @@ if ($action == 'create') {
print ''.$langs->trans('SendMail').'';
} else {
if ($usercansend) {
- print ''.$langs->trans('SendMail').'';
+ print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=presend&mode=init#formmailbeforetitle', '', true, $params);
} else {
- print ''.$langs->trans('SendMail').'';
+ print dolGetButtonAction($langs->trans('SendMail'), '', 'default', '#', '', false, $params);
}
}
}
@@ -5416,10 +5427,12 @@ if ($action == 'create') {
} else {
if ($object->type == Facture::TYPE_DEPOSIT && $resteapayer == 0) {
// For down payment, we refuse to receive more than amount to pay.
- print ''.$langs->trans('DoPayment').'';
+ $params['attr']['title'] = $langs->trans('DisabledBecauseRemainderToPayIsZero');
+ print dolGetButtonAction($langs->trans('DoPayment'), '', 'default', '#', '', false, $params);
} else {
// Sometimes we can receive more, so we accept to enter more and will offer a button to convert into discount (but it is not a credit note, just a prepayment done)
- print ''.$langs->trans('DoPayment').'';
+ //print ''.$langs->trans('DoPayment').'';
+ print dolGetButtonAction($langs->trans('DoPayment'), '', 'default', DOL_URL_ROOT.'/compta/paiement.php?facid='.$object->id.'&action=create&accountid='.$object->fk_account, '', true, $params);
}
}
}
@@ -5468,9 +5481,10 @@ if ($action == 'create') {
) {
if ($object->type == Facture::TYPE_DEPOSIT && price2num($object->total_ttc, 'MT') != price2num($sumofpaymentall, 'MT')) {
// We can close a down payment only if paid amount is same than amount of down payment (by definition)
- print ''.$langs->trans('ClassifyPaid').'';
+ $params['attr']['title'] = $langs->trans('AmountPaidMustMatchAmountOfDownPayment');
+ print dolGetButtonAction($langs->trans('ClassifyPaid'), '', 'default', '#', '', false, $params);
} else {
- print ''.$langs->trans('ClassifyPaid').'';
+ print dolGetButtonAction($langs->trans('ClassifyPaid'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=paid', '', true, $params);
}
}
@@ -5515,13 +5529,13 @@ if ($action == 'create') {
// Clone
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $usercancreate) {
- print ''.$langs->trans("ToClone").'';
+ print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=clone&object=invoice', '', true, $params);
}
// Clone as predefined / Create template
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut == 0 && $usercancreate) {
if (!$objectidnext && count($object->lines) > 0) {
- print ''.$langs->trans("ChangeIntoRepeatableInvoice").'';
+ print dolGetButtonAction($langs->trans('ChangeIntoRepeatableInvoice'), '', 'default', DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$object->id.'&action=create', '', true, $params);
}
}
@@ -5554,25 +5568,35 @@ if ($action == 'create') {
// Delete
$isErasable = $object->is_erasable();
+ $params = array(
+ 'attr' => array(
+ 'title' => '',
+ 'class' => 'classfortooltip'
+ )
+ );
if ($usercandelete || ($usercancreate && $isErasable == 1)) { // isErasable = 1 means draft with temporary ref (draft can always be deleted with no need of permissions)
- //var_dump($isErasable);
+ $enableDelete = false;
+ $deleteHref = '#';
if ($isErasable == -4) {
- print ''.$langs->trans('Delete').'';
+ $params['attr']['title'] = $langs->trans('DisabledBecausePayments');
} elseif ($isErasable == -3) {
- print ''.$langs->trans('Delete').'';
+ $params['attr']['title'] = $langs->trans('DisabledBecauseNotLastSituationInvoice');
} elseif ($isErasable == -2) {
- print ''.$langs->trans('Delete').'';
+ $params['attr']['title'] = $langs->trans('DisabledBecauseNotLastInvoice');
} elseif ($isErasable == -1) {
- print ''.$langs->trans('Delete').'';
+ $params['attr']['title'] = $langs->trans('DisabledBecauseDispatchedInBookkeeping');
} elseif ($isErasable <= 0) { // Any other cases
- print ''.$langs->trans('Delete').'';
+ $params['attr']['title'] = $langs->trans('DisabledBecauseNotErasable');
} elseif ($objectidnext) {
- print ''.$langs->trans('Delete').'';
+ $params['attr']['title'] = $langs->trans('DisabledBecauseReplacedInvoice');
} else {
- print 'id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'';
+ $deleteHref = $_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=delete&token='.newToken();
+ $enableDelete = true;
}
+ print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $deleteHref, '', $enableDelete, $params);
} else {
- print ''.$langs->trans('Delete').'';
+ $params['attr']['title'] = $langs->trans('NotAllowed');
+ print dolGetButtonAction($langs->trans('Delete'), '', 'delete', '#', '', false, $params);
}
}
print '';