mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-28 12:21:29 +01:00
Clean code
This commit is contained in:
@@ -5719,32 +5719,32 @@ if ($action == 'create') {
|
|||||||
$isErasable = $object->is_erasable();
|
$isErasable = $object->is_erasable();
|
||||||
$params = array(
|
$params = array(
|
||||||
'attr' => array(
|
'attr' => array(
|
||||||
'title' => '',
|
|
||||||
'class' => 'classfortooltip'
|
'class' => 'classfortooltip'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
if ($usercandelete || ($usercancreate && $isErasable == 1)) { // isErasable = 1 means draft with temporary ref (draft can always be deleted with no need of permissions)
|
if ($usercandelete || ($usercancreate && $isErasable == 1)) { // isErasable = 1 means draft with temporary ref (draft can always be deleted with no need of permissions)
|
||||||
$enableDelete = false;
|
$enableDelete = false;
|
||||||
$deleteHref = '#';
|
$deleteHref = '#';
|
||||||
|
$htmltooltip = '';
|
||||||
if ($isErasable == -4) {
|
if ($isErasable == -4) {
|
||||||
$params['attr']['title'] = $langs->trans('DisabledBecausePayments');
|
$htmltooltip = $langs->trans('DisabledBecausePayments');
|
||||||
} elseif ($isErasable == -3) {
|
} elseif ($isErasable == -3) {
|
||||||
$params['attr']['title'] = $langs->trans('DisabledBecauseNotLastSituationInvoice');
|
$htmltooltip = $langs->trans('DisabledBecauseNotLastSituationInvoice');
|
||||||
} elseif ($isErasable == -2) {
|
} elseif ($isErasable == -2) {
|
||||||
$params['attr']['title'] = $langs->trans('DisabledBecauseNotLastInvoice');
|
$htmltooltip = $langs->trans('DisabledBecauseNotLastInvoice');
|
||||||
} elseif ($isErasable == -1) {
|
} elseif ($isErasable == -1) {
|
||||||
$params['attr']['title'] = $langs->trans('DisabledBecauseDispatchedInBookkeeping');
|
$htmltooltip = $langs->trans('DisabledBecauseDispatchedInBookkeeping');
|
||||||
} elseif ($isErasable <= 0) { // Any other cases
|
} elseif ($isErasable <= 0) { // Any other cases
|
||||||
$params['attr']['title'] = $langs->trans('DisabledBecauseNotErasable');
|
$htmltooltip = $langs->trans('DisabledBecauseNotErasable');
|
||||||
} elseif ($objectidnext) {
|
} elseif ($objectidnext) {
|
||||||
$params['attr']['title'] = $langs->trans('DisabledBecauseReplacedInvoice');
|
$htmltooltip = $langs->trans('DisabledBecauseReplacedInvoice');
|
||||||
} else {
|
} else {
|
||||||
$deleteHref = $_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=delete&token='.newToken();
|
$deleteHref = $_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=delete&token='.newToken();
|
||||||
$enableDelete = true;
|
$enableDelete = true;
|
||||||
}
|
}
|
||||||
print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $deleteHref, '', $enableDelete, $params);
|
print dolGetButtonAction($htmltooltip, $langs->trans('Delete'), 'delete', $deleteHref, '', $enableDelete, $params);
|
||||||
} else {
|
} else {
|
||||||
print dolGetButtonAction($langs->trans('Delete'), '', 'delete', '#', '', false);
|
print dolGetButtonAction($langs->trans('Delete'), $langs->trans('Delete'), 'delete', '#', '', false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@@ -10567,7 +10567,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
|
|||||||
* @param array $params = [ // Various params for future : recommended rather than adding more function arguments
|
* @param array $params = [ // Various params for future : recommended rather than adding more function arguments
|
||||||
* 'attr' => [ // to add or override button attributes
|
* 'attr' => [ // to add or override button attributes
|
||||||
* 'xxxxx' => '', // your xxxxx attribute you want
|
* 'xxxxx' => '', // your xxxxx attribute you want
|
||||||
* 'class' => '', // to add more css class to the button class attribute
|
* 'class' => 'reposition', // to add more css class to the button class attribute
|
||||||
* 'classOverride' => '' // to replace class attribute of the button
|
* 'classOverride' => '' // to replace class attribute of the button
|
||||||
* ],
|
* ],
|
||||||
* 'confirm' => [
|
* 'confirm' => [
|
||||||
@@ -10614,7 +10614,7 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url =
|
|||||||
if (empty($userRight)) {
|
if (empty($userRight)) {
|
||||||
$attr['class'] = 'butActionRefused';
|
$attr['class'] = 'butActionRefused';
|
||||||
$attr['href'] = '';
|
$attr['href'] = '';
|
||||||
$attr['title'] = $langs->trans('NotEnoughPermissions');
|
$attr['title'] = (($label && $text && $label != $text) ? $label : $langs->trans('NotEnoughPermissions'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($id)) {
|
if (!empty($id)) {
|
||||||
@@ -10670,7 +10670,7 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url =
|
|||||||
|
|
||||||
$TCompiledAttr = array();
|
$TCompiledAttr = array();
|
||||||
foreach ($attr as $key => $value) {
|
foreach ($attr as $key => $value) {
|
||||||
$TCompiledAttr[] = $key.'="'.$value.'"';
|
$TCompiledAttr[] = $key.'= "'.$value.'"';
|
||||||
}
|
}
|
||||||
|
|
||||||
$compiledAttributes = empty($TCompiledAttr) ? '' : implode(' ', $TCompiledAttr);
|
$compiledAttributes = empty($TCompiledAttr) ? '' : implode(' ', $TCompiledAttr);
|
||||||
|
|||||||
@@ -3784,21 +3784,26 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
// Delete
|
// Delete
|
||||||
$isErasable = $object->is_erasable();
|
$isErasable = $object->is_erasable();
|
||||||
if ($action != 'confirm_edit' && ($user->rights->fournisseur->facture->supprimer || ($usercancreate && $isErasable == 1))) { // isErasable = 1 means draft with temporary ref (draft can always be deleted with no need of permissions)
|
if ($action != 'confirm_edit' && ($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;
|
||||||
|
$htmltooltip = '';
|
||||||
|
$params = (empty($conf->use_javascript_ajax) ? array() : array('attr' => array('class' => 'reposition')));
|
||||||
|
//var_dump($isErasable); var_dump($params);
|
||||||
if ($isErasable == -4) {
|
if ($isErasable == -4) {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecausePayments").'">'.$langs->trans('Delete').'</a>';
|
$htmltooltip = $langs->trans("DisabledBecausePayments");
|
||||||
} elseif ($isErasable == -3) { // Should never happen with supplier invoice
|
} elseif ($isErasable == -3) { // Should never happen with supplier invoice
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseNotLastSituationInvoice").'">'.$langs->trans('Delete').'</a>';
|
$htmltooltip = $langs->trans("DisabledBecauseNotLastSituationInvoice");
|
||||||
} elseif ($isErasable == -2) { // Should never happen with supplier invoice
|
} elseif ($isErasable == -2) { // Should never happen with supplier invoice
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseNotLastInvoice").'">'.$langs->trans('Delete').'</a>';
|
$htmltooltip = $langs->trans("DisabledBecauseNotLastInvoice");
|
||||||
} elseif ($isErasable == -1) {
|
} elseif ($isErasable == -1) {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseDispatchedInBookkeeping").'">'.$langs->trans('Delete').'</a>';
|
$htmltooltip = $langs->trans("DisabledBecauseDispatchedInBookkeeping");
|
||||||
} elseif ($isErasable <= 0) { // Any other cases
|
} elseif ($isErasable <= 0) { // Any other cases
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseNotErasable").'">'.$langs->trans('Delete').'</a>';
|
$htmltooltip = $langs->trans("DisabledBecauseNotErasable");
|
||||||
} else {
|
} else {
|
||||||
print '<a class="butActionDelete'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a>';
|
$enableDelete = true;
|
||||||
|
$htmltooltip = '';
|
||||||
}
|
}
|
||||||
|
print dolGetButtonAction($htmltooltip, $langs->trans("Delete"), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), $object->id, $enableDelete, $params);
|
||||||
}
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ BillsStatistics=Customers invoices statistics
|
|||||||
BillsStatisticsSuppliers=Vendors invoices statistics
|
BillsStatisticsSuppliers=Vendors invoices statistics
|
||||||
DisabledBecauseDispatchedInBookkeeping=Disabled because invoice was dispatched into bookkeeping
|
DisabledBecauseDispatchedInBookkeeping=Disabled because invoice was dispatched into bookkeeping
|
||||||
DisabledBecauseNotLastInvoice=Disabled because invoice is not erasable. Some invoices were recorded after this one and it will create holes in the counter.
|
DisabledBecauseNotLastInvoice=Disabled because invoice is not erasable. Some invoices were recorded after this one and it will create holes in the counter.
|
||||||
|
DisabledBecauseNotLastSituationInvoice=Disabled because invoice is not erasable. This invoice is not the last one in situation invoice cycle.
|
||||||
DisabledBecauseNotErasable=Disabled because cannot be erased
|
DisabledBecauseNotErasable=Disabled because cannot be erased
|
||||||
InvoiceStandard=Standard invoice
|
InvoiceStandard=Standard invoice
|
||||||
InvoiceStandardAsk=Standard invoice
|
InvoiceStandardAsk=Standard invoice
|
||||||
|
|||||||
Reference in New Issue
Block a user