Merge branch '7.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2018-02-02 10:41:20 +01:00
commit 2e705b5a88
5 changed files with 55 additions and 27 deletions

View File

@ -4,6 +4,8 @@ English Dolibarr ChangeLog
***** ChangeLog for 7.0.0 compared to 6.0.5 *****
For users:
NEW: When payment is registered, PDF of invoices are also regenerated so payments
appears with no need to click on regenerate.
NEW: #5711 Add shipment line deleting and editing for draft shipments.
NEW: Accept substitution key __[ABC]__ replaced with value of const ABC
NEW: Accountancy Add variant on sell account for intracommunity sales & export sales

View File

@ -257,7 +257,7 @@ if (empty($reshook))
if (! $error)
{
$paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices')=='on'?1:0)); // This include closing invoices
$paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices')=='on'?1:0)); // This include closing invoices and regenerating documents
if ($paiement_id < 0)
{
setEventMessages($paiement->error, $paiement->errors, 'errors');

View File

@ -141,7 +141,7 @@ class Paiement extends CommonObject
/**
* Create payment of invoices into database.
* Use this->amounts to have list of invoices for the payment.
* For payment of a customer invoice, amounts are postive, for payment of credit note, amounts are negative
* For payment of a customer invoice, amounts are positive, for payment of credit note, amounts are negative
*
* @param User $user Object user
* @param int $closepaidinvoices 1=Also close payed invoices to paid, 0=Do nothing more
@ -233,11 +233,12 @@ class Paiement extends CommonObject
$resql=$this->db->query($sql);
if ($resql)
{
$invoice=new Facture($this->db);
$invoice->fetch($facid);
// If we want to closed payed invoices
if ($closepaidinvoices)
{
$invoice=new Facture($this->db);
$invoice->fetch($facid);
$paiement = $invoice->getSommePaiement();
$creditnotes=$invoice->getSumCreditNotesUsed();
$deposits=$invoice->getSumDepositsUsed();
@ -338,26 +339,25 @@ class Paiement extends CommonObject
$error++;
}
}
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$outputlangs = $langs;
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $invoice->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$ret = $invoice->fetch($id); // Reload to get new records
$result = $invoice->generateDocument($invoice->modelpdf, $outputlangs);
if ($result < 0) {
setEventMessages($invoice->error, $invoice->errors, 'errors');
$error++;
}
}
}
// Regenerate documents of invoices
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$outputlangs = $langs;
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $invoice->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$ret = $invoice->fetch($facid); // Reload to get new records
$result = $invoice->generateDocument($invoice->modelpdf, $outputlangs);
if ($result < 0) {
setEventMessages($invoice->error, $invoice->errors, 'errors');
$error++;
}
}
}
else
{

View File

@ -1706,7 +1706,15 @@ function dol_convert_file($fileinput, $ext='png', $fileoutput='')
if (empty($fileoutput)) $fileoutput=$fileinput.".".$ext;
$count = $image->getNumberImages();
$ret = $image->writeImages($fileoutput, true);
if (! dol_is_file($fileoutput) || is_writeable($fileoutput))
{
$ret = $image->writeImages($fileoutput, true);
}
else
{
dol_syslog("Warning: Failed to write cache preview file '.$fileoutput.'. Check permission on file/dir", LOG_ERR);
}
if ($ret) return $count;
else return -3;
}

View File

@ -210,11 +210,12 @@ class PaiementFourn extends Paiement
$resql=$this->db->query($sql);
if ($resql)
{
$invoice=new FactureFournisseur($this->db);
$invoice->fetch($facid);
// If we want to closed payed invoices
if ($closepaidinvoices)
{
$invoice=new FactureFournisseur($this->db);
$invoice->fetch($facid);
$paiement = $invoice->getSommePaiement();
//$creditnotes=$invoice->getSumCreditNotesUsed();
$creditnotes=0;
@ -228,17 +229,34 @@ class PaiementFourn extends Paiement
}
else dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing.");
}
// Regenerate documents of invoices
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$outputlangs = $langs;
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $invoice->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$ret = $invoice->fetch($facid); // Reload to get new records
$result = $invoice->generateDocument($invoice->modelpdf, $outputlangs);
if ($result < 0) {
setEventMessages($invoice->error, $invoice->errors, 'errors');
$error++;
}
}
}
else
{
dol_syslog('Paiement::Create Erreur INSERT dans paiement_facture '.$facid);
$this->error=$this->db->lasterror();
$error++;
}
}
else
{
dol_syslog('PaiementFourn::Create Montant non numerique',LOG_ERR);
dol_syslog(get_class($this).'::Create Amount line '.$key.' not a number. We discard it.');
}
}