Merge branch 'new_creditnote' of github.com:atm-maxime/dolibarr into new_creditnote
This commit is contained in:
commit
bd831b1f24
@ -280,6 +280,24 @@ if ($action == 'set_FAC_AUTO_FILLJS')
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'set_INVOICE_CREDIT_NOTE_STANDALONE')
|
||||
{
|
||||
$freetext = GETPOST('INVOICE_CREDIT_NOTE_STANDALONE'); // No alpha here, we want exact string
|
||||
|
||||
$res = dolibarr_set_const($db, "INVOICE_CREDIT_NOTE_STANDALONE",$freetext,'chaine',0,'',$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessage($langs->trans("SetupSaved"));
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($langs->trans("Error"),'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -750,6 +768,34 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" /
|
||||
print "</td></tr>\n";
|
||||
print '</form>';
|
||||
|
||||
// Add js auto fill amount on paiement form
|
||||
$var=! $var;
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
|
||||
print '<input type="hidden" name="action" value="set_FAC_AUTO_FILLJS" />';
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("JSOnPaimentBill");
|
||||
print '</td><td width="60" align="center">';
|
||||
print $form->selectyesno("FAC_AUTO_FILLJS",$conf->global->FAC_AUTO_FILLJS,1);
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" />';
|
||||
print "</td></tr>\n";
|
||||
print '</form>';
|
||||
|
||||
// Allow to create credit note not related to an invoice
|
||||
$var=! $var;
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
|
||||
print '<input type="hidden" name="action" value="set_INVOICE_CREDIT_NOTE_STANDALONE" />';
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("AllowCreditNoteWithoutRelatedInvoice");
|
||||
print '</td><td width="60" align="center">';
|
||||
print $form->selectyesno("INVOICE_CREDIT_NOTE_STANDALONE",$conf->global->INVOICE_CREDIT_NOTE_STANDALONE,1);
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" />';
|
||||
print "</td></tr>\n";
|
||||
print '</form>';
|
||||
|
||||
$var=! $var;
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
|
||||
@ -784,20 +830,6 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" /
|
||||
print "</td></tr>\n";
|
||||
print '</form>';
|
||||
|
||||
// Add js auto fill amount on paiement form
|
||||
$var=! $var;
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
|
||||
print '<input type="hidden" name="action" value="set_FAC_AUTO_FILLJS" />';
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("JSOnPaimentBill");
|
||||
print '</td><td width="60" align="center">';
|
||||
print $form->selectyesno("FAC_AUTO_FILLJS",$conf->global->FAC_AUTO_FILLJS,1);
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" />';
|
||||
print "</td></tr>\n";
|
||||
print '</form>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
|
||||
@ -713,7 +713,8 @@ if (empty($reshook))
|
||||
// Credit note invoice
|
||||
if ($_POST['type'] == Facture::TYPE_CREDIT_NOTE)
|
||||
{
|
||||
if (! ($_POST['fac_avoir'] > 0))
|
||||
$sourceinvoice = GETPOST('fac_avoir');
|
||||
if (! ($sourceinvoice > 0) && empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE))
|
||||
{
|
||||
$error ++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CorrectInvoice")), null, 'errors');
|
||||
@ -746,7 +747,7 @@ if (empty($reshook))
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
|
||||
// Proprietes particulieres a facture avoir
|
||||
$object->fk_facture_source = $_POST['fac_avoir'];
|
||||
$object->fk_facture_source = $sourceinvoice > 0 ? $sourceinvoice : '';
|
||||
$object->type = Facture::TYPE_CREDIT_NOTE;
|
||||
|
||||
$id = $object->create($user);
|
||||
@ -2033,7 +2034,7 @@ if ($action == 'create')
|
||||
$newinvoice_static->paye = $valarray ['paye'];
|
||||
|
||||
$optionsav .= '<option value="' . $key . '"';
|
||||
if ($key == $_POST['fac_avoir'])
|
||||
if ($key == GETPOST('fac_avoir'))
|
||||
$optionsav .= ' selected';
|
||||
$optionsav .= '>';
|
||||
$optionsav .= $newinvoice_static->ref;
|
||||
@ -2831,7 +2832,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
$facreplaced->fetch($object->fk_facture_source);
|
||||
print ' (' . $langs->transnoentities("ReplaceInvoice", $facreplaced->getNomUrl(1)) . ')';
|
||||
}
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE) {
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE && !empty($object->fk_facture_source)) {
|
||||
$facusing = new Facture($db);
|
||||
$facusing->fetch($object->fk_facture_source);
|
||||
print ' (' . $langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)) . ')';
|
||||
@ -3685,6 +3686,15 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="facture/fiche-rec.php?facid=' . $object->id . '&action=create">' . $langs->trans("ChangeIntoRepeatableInvoice") . '</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
// 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 .'&fac_avoir=' . $object->id . '&action=create&type=2">' . $langs->trans("CreateCreditNote") . '</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
//Create next situation invoice
|
||||
if ($user->rights->facture->creer && ($object->type == 5) && ($object->statut == 1 || $object->statut == 2)) {
|
||||
|
||||
@ -1503,7 +1503,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("ReplacementInvoice").' : '.$outputlangs->convToOutputCharset($objectreplaced->ref), '', 'R');
|
||||
}
|
||||
if ($object->type == 2)
|
||||
if ($object->type == 2 && !empty($object->fk_facture_source))
|
||||
{
|
||||
$objectreplaced=new Facture($this->db);
|
||||
$objectreplaced->fetch($object->fk_facture_source);
|
||||
|
||||
@ -1177,6 +1177,7 @@ CreditNotePDFModules=Credit note document models
|
||||
CreditNote=Credit note
|
||||
CreditNotes=Credit notes
|
||||
ForceInvoiceDate=Force invoice date to validation date
|
||||
AllowCreditNoteWithoutRelatedInvoice=Allow to create credit note without a related invoice
|
||||
DisableRepeatable=Disable repeatable invoices
|
||||
SuggestedPaymentModesIfNotDefinedInInvoice=Suggested payments mode on invoice by default if not defined for invoice
|
||||
EnableEditDeleteValidInvoice=Enable the possibility to edit/delete valid invoice with no payment
|
||||
|
||||
@ -88,6 +88,7 @@ ClassifyCanceled=Classify 'Abandoned'
|
||||
ClassifyClosed=Classify 'Closed'
|
||||
ClassifyUnBilled=Classify 'Unbilled'
|
||||
CreateBill=Create Invoice
|
||||
CreateCreditNote=Create credit note
|
||||
AddBill=Create invoice or credit note
|
||||
AddToDraftInvoices=Add to draft invoice
|
||||
DeleteBill=Delete invoice
|
||||
|
||||
Loading…
Reference in New Issue
Block a user