New : add shortcut to create a credit note from the concerned bill

This commit is contained in:
Maxime Kohlhaas 2015-07-08 14:01:30 +02:00
parent 7e0229ded0
commit dc0a1b7fd5

View File

@ -2073,7 +2073,7 @@ if ($action == 'create')
$newinvoice_static->paye = $valarray ['paye']; $newinvoice_static->paye = $valarray ['paye'];
$optionsav .= '<option value="' . $key . '"'; $optionsav .= '<option value="' . $key . '"';
if ($key == $_POST['fac_avoir']) if ($key == GETPOST('fac_avoir'))
$optionsav .= ' selected'; $optionsav .= ' selected';
$optionsav .= '>'; $optionsav .= '>';
$optionsav .= $newinvoice_static->ref; $optionsav .= $newinvoice_static->ref;
@ -3729,6 +3729,15 @@ else if ($id > 0 || ! empty($ref))
} }
} }
// Create a credit note
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut > 0 && $user->rights->facture->creer)
{
if (! $objectidnext)
{
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?socid=' . $object->socid .'&amp;fac_avoir=' . $object->id . '&amp;action=create&amp;type=2">' . $langs->trans("CreateCreditNote") . '</a></div>';
}
}
//Create next situation invoice //Create next situation invoice
if ($user->rights->facture->creer && ($object->type == 5) && ($object->statut == 1 || $object->statut == 2)) { if ($user->rights->facture->creer && ($object->type == 5) && ($object->statut == 1 || $object->statut == 2)) {
if ($object->is_last_in_cycle() && $object->situation_final != 1) { if ($object->is_last_in_cycle() && $object->situation_final != 1) {