Uniformsize code/options

This commit is contained in:
Laurent Destailleur 2017-09-27 16:29:33 +02:00
parent 8ae798f2e5
commit be60e66d62
2 changed files with 41 additions and 31 deletions

View File

@ -604,7 +604,9 @@ if (empty($reshook))
$ventilExportCompta = $object->getVentilExportCompta(); $ventilExportCompta = $object->getVentilExportCompta();
// On verifie si aucun paiement n'a ete effectue // On verifie si aucun paiement n'a ete effectue
if ($resteapayer == $object->total_ttc && $object->paye == 0 && $ventilExportCompta == 0) if ($ventilExportCompta == 0)
{
if (! empty($conf->global->INVOICE_CAN_ALWAYS_BE_EDITED) || ($resteapayer == $object->total_ttc && empty($object->paye)))
{ {
$result=$object->set_draft($user, $idwarehouse); $result=$object->set_draft($user, $idwarehouse);
if ($result<0) setEventMessages($object->error, $object->errors, 'errors'); if ($result<0) setEventMessages($object->error, $object->errors, 'errors');
@ -629,6 +631,7 @@ if (empty($reshook))
} }
} }
} }
}
// Classify "paid" // Classify "paid"
else if ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->facture->paiement) else if ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->facture->paiement)
@ -4115,12 +4118,14 @@ else if ($id > 0 || ! empty($ref))
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) { if (empty($reshook)) {
// Editer une facture deja validee, sans paiement effectue et pas exporte en compta // Editer une facture deja validee, sans paiement effectue et pas exporte en compta
if ($object->statut == 1) if ($object->statut == Facture::STATUS_VALIDATED)
{ {
// On verifie si les lignes de factures ont ete exportees en compta et/ou ventilees // On verifie si les lignes de factures ont ete exportees en compta et/ou ventilees
$ventilExportCompta = $object->getVentilExportCompta(); $ventilExportCompta = $object->getVentilExportCompta();
if ($resteapayer == $object->total_ttc && empty($object->paye) && $ventilExportCompta == 0) if ($ventilExportCompta == 0)
{
if (! empty($conf->global->INVOICE_CAN_ALWAYS_BE_EDITED) || ($resteapayer == $object->total_ttc && empty($object->paye)))
{ {
if (! $objectidnext && $object->is_last_in_cycle()) if (! $objectidnext && $object->is_last_in_cycle())
{ {
@ -4138,6 +4143,11 @@ else if ($id > 0 || ! empty($ref))
} }
} }
} }
else
{
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseDispatchedInAccounting") . '">' . $langs->trans('Modify') . '</span></div>';
}
}
$discount = new DiscountAbsolute($db); $discount = new DiscountAbsolute($db);
$result = $discount->fetch(0, $object->id); $result = $discount->fetch(0, $object->id);
@ -4158,7 +4168,7 @@ else if ($id > 0 || ! empty($ref))
} }
// Validate // Validate
if ($object->statut == 0 && 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 ($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 ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->creer)) if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->validate))) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->validate)))
{ {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 914 B

After

Width:  |  Height:  |  Size: 929 B