Clean code
This commit is contained in:
parent
7217c3e74a
commit
c63d310f2f
@ -5719,32 +5719,32 @@ if ($action == 'create') {
|
||||
$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)
|
||||
$enableDelete = false;
|
||||
$deleteHref = '#';
|
||||
$htmltooltip = '';
|
||||
if ($isErasable == -4) {
|
||||
$params['attr']['title'] = $langs->trans('DisabledBecausePayments');
|
||||
$htmltooltip = $langs->trans('DisabledBecausePayments');
|
||||
} elseif ($isErasable == -3) {
|
||||
$params['attr']['title'] = $langs->trans('DisabledBecauseNotLastSituationInvoice');
|
||||
$htmltooltip = $langs->trans('DisabledBecauseNotLastSituationInvoice');
|
||||
} elseif ($isErasable == -2) {
|
||||
$params['attr']['title'] = $langs->trans('DisabledBecauseNotLastInvoice');
|
||||
$htmltooltip = $langs->trans('DisabledBecauseNotLastInvoice');
|
||||
} elseif ($isErasable == -1) {
|
||||
$params['attr']['title'] = $langs->trans('DisabledBecauseDispatchedInBookkeeping');
|
||||
$htmltooltip = $langs->trans('DisabledBecauseDispatchedInBookkeeping');
|
||||
} elseif ($isErasable <= 0) { // Any other cases
|
||||
$params['attr']['title'] = $langs->trans('DisabledBecauseNotErasable');
|
||||
$htmltooltip = $langs->trans('DisabledBecauseNotErasable');
|
||||
} elseif ($objectidnext) {
|
||||
$params['attr']['title'] = $langs->trans('DisabledBecauseReplacedInvoice');
|
||||
$htmltooltip = $langs->trans('DisabledBecauseReplacedInvoice');
|
||||
} else {
|
||||
$deleteHref = $_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=delete&token='.newToken();
|
||||
$enableDelete = true;
|
||||
}
|
||||
print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $deleteHref, '', $enableDelete, $params);
|
||||
print dolGetButtonAction($htmltooltip, $langs->trans('Delete'), 'delete', $deleteHref, '', $enableDelete, $params);
|
||||
} else {
|
||||
print dolGetButtonAction($langs->trans('Delete'), '', 'delete', '#', '', false);
|
||||
print dolGetButtonAction($langs->trans('Delete'), $langs->trans('Delete'), 'delete', '#', '', false);
|
||||
}
|
||||
}
|
||||
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
|
||||
* 'attr' => [ // to add or override button attributes
|
||||
* '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
|
||||
* ],
|
||||
* 'confirm' => [
|
||||
@ -10614,7 +10614,7 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url =
|
||||
if (empty($userRight)) {
|
||||
$attr['class'] = 'butActionRefused';
|
||||
$attr['href'] = '';
|
||||
$attr['title'] = $langs->trans('NotEnoughPermissions');
|
||||
$attr['title'] = (($label && $text && $label != $text) ? $label : $langs->trans('NotEnoughPermissions'));
|
||||
}
|
||||
|
||||
if (!empty($id)) {
|
||||
@ -10670,7 +10670,7 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url =
|
||||
|
||||
$TCompiledAttr = array();
|
||||
foreach ($attr as $key => $value) {
|
||||
$TCompiledAttr[] = $key.'="'.$value.'"';
|
||||
$TCompiledAttr[] = $key.'= "'.$value.'"';
|
||||
}
|
||||
|
||||
$compiledAttributes = empty($TCompiledAttr) ? '' : implode(' ', $TCompiledAttr);
|
||||
|
||||
@ -3784,21 +3784,26 @@ if ($action == 'create') {
|
||||
|
||||
// Delete
|
||||
$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)
|
||||
//var_dump($isErasable);
|
||||
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)
|
||||
$enableDelete = false;
|
||||
$htmltooltip = '';
|
||||
$params = (empty($conf->use_javascript_ajax) ? array() : array('attr' => array('class' => 'reposition')));
|
||||
//var_dump($isErasable); var_dump($params);
|
||||
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
|
||||
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
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseNotLastInvoice").'">'.$langs->trans('Delete').'</a>';
|
||||
$htmltooltip = $langs->trans("DisabledBecauseNotLastInvoice");
|
||||
} 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
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseNotErasable").'">'.$langs->trans('Delete').'</a>';
|
||||
$htmltooltip = $langs->trans("DisabledBecauseNotErasable");
|
||||
} 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>';
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@ BillsStatistics=Customers invoices statistics
|
||||
BillsStatisticsSuppliers=Vendors invoices statistics
|
||||
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.
|
||||
DisabledBecauseNotLastSituationInvoice=Disabled because invoice is not erasable. This invoice is not the last one in situation invoice cycle.
|
||||
DisabledBecauseNotErasable=Disabled because cannot be erased
|
||||
InvoiceStandard=Standard invoice
|
||||
InvoiceStandardAsk=Standard invoice
|
||||
|
||||
Loading…
Reference in New Issue
Block a user