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

Conflicts:
	htdocs/filefunc.inc.php
	htdocs/takepos/takepos.php
This commit is contained in:
Laurent Destailleur 2019-10-20 15:30:28 +02:00
commit 5a4960f7ae
9 changed files with 43 additions and 25 deletions

View File

@ -30,7 +30,7 @@ Following changes may create regressions for some external modules, but were nec
***** ChangeLog for 10.0.3 compared to 10.0.2 ***** ***** ChangeLog for 10.0.3 compared to 10.0.2 *****
IMPORTANT : This version fixes a serious bug in saving the units of weight, size, surface and volume on product card. IMPORTANT : This version fixes a serious bug in saving the units of weight, size, surface and volume on product card.
The unit were not saved correctly in database making calculation on shipments wrong. The unit were not saved correctly in database making calculation on shipments wrong.
Update to this version must be done if you use them and have installed version 10.0.0, 10.0.1 or 10.0.2 and set some products after installing or upgrading to this version. Update to this version must be done if you use them and have installed version 10.0.0, 10.0.1 or 10.0.2 and set some products after installing or upgrading to one of this version.
Once update is done you must then edit (manually) the product that has bad unit to set the correct unit to have features restored. Once update is done you must then edit (manually) the product that has bad unit to set the correct unit to have features restored.
FIX: #11702 FIX: #11702
@ -92,6 +92,9 @@ FIX: Update of leave request when CSRF with token is on
FIX: Var not enough sanitized FIX: Var not enough sanitized
FIX: wrong test FIX: wrong test
FIX: XSS FIX: XSS
FIX: Payment from POS ware not recorded.
FIX: Can validate invoice with amount including tax of zero for the case of having a final invoice with
VAT that includes a deposit without vat.
***** ChangeLog for 10.0.2 compared to 10.0.1 ***** ***** ChangeLog for 10.0.2 compared to 10.0.1 *****
FIX: #10460 compatibility with MariaDB 10.4 FIX: #10460 compatibility with MariaDB 10.4

View File

@ -278,8 +278,11 @@ if (empty($reshook))
$action = ''; $action = '';
} }
} else { } else {
// Si non avoir, le signe doit etre positif // If not a credit note, amount with tax must be positive or nul.
if (empty($conf->global->FACTURE_ENABLE_NEGATIVE) && $object->total_ht < 0) { // Note that amount excluding tax can be negative because you can have a invoice of 100 with vat of 20 that
// consumes a credit note of 100 with vat 0 (total with tax is 0 but without tax is -20).
// For some cases, credit notes can have a vat of 0 (for example when selling goods in France).
if (empty($conf->global->FACTURE_ENABLE_NEGATIVE) && $object->total_ttc < 0) {
setEventMessages($langs->trans("ErrorInvoiceOfThisTypeMustBePositive"), null, 'errors'); setEventMessages($langs->trans("ErrorInvoiceOfThisTypeMustBePositive"), null, 'errors');
$action = ''; $action = '';
} }

View File

@ -114,7 +114,7 @@ if ($object->id)
$morehtmlref.=$form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1); $morehtmlref.=$form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
$morehtmlref.='</div>'; $morehtmlref.='</div>';
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/tva/index.php?restore_lastsearch_values=1">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/compta/tva/list.php?restore_lastsearch_values=1">' . $langs->trans("BackToList") . '</a>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status

View File

@ -91,13 +91,15 @@ class DiscountAbsolute
public $fk_facture; public $fk_facture;
/** /**
* @var int ID credit note having caused the discount * @var int ID credit note or deposit used to create the discount
*/ */
public $fk_facture_source; public $fk_facture_source;
public $ref_facture_source; // Ref credit note or deposit used to create the discount
public $type_facture_source;
public $ref_facture_source; // Ref credit note having caused the discount public $fk_invoice_supplier_source;
public $ref_invoice_supplier_source; // Ref credit note or deposit used to create the discount
public $ref_invoice_supplier_source; public $type_invoice_supplier_source;
/** /**
* Constructor * Constructor
@ -135,7 +137,8 @@ class DiscountAbsolute
$sql.= " sr.multicurrency_amount_ht, sr.multicurrency_amount_tva, sr.multicurrency_amount_ttc,"; $sql.= " sr.multicurrency_amount_ht, sr.multicurrency_amount_tva, sr.multicurrency_amount_ttc,";
$sql.= " sr.fk_facture_line, sr.fk_facture, sr.fk_facture_source, sr.fk_invoice_supplier_line, sr.fk_invoice_supplier, sr.fk_invoice_supplier_source, sr.description,"; $sql.= " sr.fk_facture_line, sr.fk_facture, sr.fk_facture_source, sr.fk_invoice_supplier_line, sr.fk_invoice_supplier, sr.fk_invoice_supplier_source, sr.description,";
$sql.= " sr.datec,"; $sql.= " sr.datec,";
$sql.= " f.ref as ref_facture_source, fsup.ref as ref_invoice_supplier_source"; $sql.= " f.ref as ref_facture_source, f.type as type_facture_source,";
$sql.= " fsup.ref as ref_invoice_supplier_source, fsup.type as type_invoice_supplier_source";
$sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as sr"; $sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as sr";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON sr.fk_facture_source = f.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON sr.fk_facture_source = f.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fsup ON sr.fk_invoice_supplier_source = fsup.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fsup ON sr.fk_invoice_supplier_source = fsup.rowid";
@ -168,12 +171,14 @@ class DiscountAbsolute
$this->fk_user = $obj->fk_user; $this->fk_user = $obj->fk_user;
$this->fk_facture_line = $obj->fk_facture_line; $this->fk_facture_line = $obj->fk_facture_line;
$this->fk_facture = $obj->fk_facture; $this->fk_facture = $obj->fk_facture;
$this->fk_facture_source = $obj->fk_facture_source; // Id avoir source $this->fk_facture_source = $obj->fk_facture_source; // Id credit note or deposit source
$this->ref_facture_source = $obj->ref_facture_source; // Ref avoir source $this->ref_facture_source = $obj->ref_facture_source; // Ref credit note or deposit source
$this->type_facture_source = $obj->type_facture_source; // Type credit note or deposit source
$this->fk_invoice_supplier_line = $obj->fk_invoice_supplier_line; $this->fk_invoice_supplier_line = $obj->fk_invoice_supplier_line;
$this->fk_invoice_supplier = $obj->fk_invoice_supplier; $this->fk_invoice_supplier = $obj->fk_invoice_supplier;
$this->fk_invoice_supplier_source = $obj->fk_invoice_supplier_source; // Id avoir source $this->fk_invoice_supplier_source = $obj->fk_invoice_supplier_source; // Id credit note or deposit source
$this->ref_invoice_supplier_source = $obj->ref_invoice_supplier_source; // Ref avoir source $this->ref_invoice_supplier_source = $obj->ref_invoice_supplier_source; // Ref credit note or deposit source
$this->type_invoice_supplier_source = $obj->type_invoice_supplier_source; // Type credit note or deposit source
$this->description = $obj->description; $this->description = $obj->description;
$this->datec = $this->db->jdate($obj->datec); $this->datec = $this->db->jdate($obj->datec);
@ -688,7 +693,7 @@ class DiscountAbsolute
if ($option == 'invoice') { if ($option == 'invoice') {
$facid=! empty($this->discount_type)?$this->fk_invoice_supplier_source:$this->fk_facture_source; $facid=! empty($this->discount_type)?$this->fk_invoice_supplier_source:$this->fk_facture_source;
$link=! empty($this->discount_type)?'/fourn/facture/card.php':'/compta/facture/card.php'; $link=! empty($this->discount_type)?'/fourn/facture/card.php':'/compta/facture/card.php';
$label=$langs->trans("ShowDiscount").': '.$this->ref_facture_source; $label=$langs->trans("ShowSourceInvoice").': '.$this->ref_facture_source;
$link = '<a href="'.DOL_URL_ROOT.$link.'?facid='.$facid.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $link = '<a href="'.DOL_URL_ROOT.$link.'?facid='.$facid.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>'; $linkend='</a>';
$ref=! empty($this->discount_type)?$this->ref_invoice_supplier_source:$this->ref_facture_source; $ref=! empty($this->discount_type)?$this->ref_invoice_supplier_source:$this->ref_facture_source;

View File

@ -182,7 +182,9 @@ class modExpenseReport extends DolibarrModules
$this->export_permission[$r]=array(array("expensereport","export")); $this->export_permission[$r]=array(array("expensereport","export"));
$this->export_fields_array[$r]=array( $this->export_fields_array[$r]=array(
'd.rowid'=>"TripId",'d.ref'=>'Ref','d.date_debut'=>'DateStart','d.date_fin'=>'DateEnd','d.date_create'=>'DateCreation','d.date_approve'=>'DateApprove', 'd.rowid'=>"TripId",'d.ref'=>'Ref','d.date_debut'=>'DateStart','d.date_fin'=>'DateEnd','d.date_create'=>'DateCreation','d.date_approve'=>'DateApprove',
'd.total_ht'=>"TotalHT",'d.total_tva'=>'TotalVAT','d.total_ttc'=>'TotalTTC','d.note_private'=>'NotePrivate','d.note_public'=>'NotePublic', 'd.total_ht'=>"TotalHT",'d.total_tva'=>'TotalVAT','d.total_ttc'=>'TotalTTC',
'd.fk_statut'=>'Status','d.paid'=>'Paid',
'd.note_private'=>'NotePrivate','d.note_public'=>'NotePublic','d.detail_cancel'=>'MOTIF_CANCEL','d.detail_refuse'=>'MOTIF_REFUS',
'u.lastname'=>'Lastname','u.firstname'=>'Firstname','u.login'=>"Login",'ed.rowid'=>'LineId','tf.code'=>'Type','ed.date'=>'Date','ed.tva_tx'=>'VATRate', 'u.lastname'=>'Lastname','u.firstname'=>'Firstname','u.login'=>"Login",'ed.rowid'=>'LineId','tf.code'=>'Type','ed.date'=>'Date','ed.tva_tx'=>'VATRate',
'ed.total_ht'=>'TotalHT','ed.total_tva'=>'TotalVAT','ed.total_ttc'=>'TotalTTC','ed.comments'=>'Comment','p.rowid'=>'ProjectId','p.ref'=>'Ref', 'ed.total_ht'=>'TotalHT','ed.total_tva'=>'TotalVAT','ed.total_ttc'=>'TotalTTC','ed.comments'=>'Comment','p.rowid'=>'ProjectId','p.ref'=>'Ref',
'user_rib.iban_prefix' => 'IBAN', 'user_rib.bic' => 'BIC', 'user_rib.code_banque' => 'BankCode', 'user_rib.bank' => 'BankName', 'user_rib.proprio' => 'BankAccountOwner', 'user_rib.iban_prefix' => 'IBAN', 'user_rib.bic' => 'BIC', 'user_rib.code_banque' => 'BankCode', 'user_rib.bank' => 'BankName', 'user_rib.proprio' => 'BankAccountOwner',
@ -190,7 +192,9 @@ class modExpenseReport extends DolibarrModules
); );
$this->export_TypeFields_array[$r]=array( $this->export_TypeFields_array[$r]=array(
'd.rowid'=>"Numeric",'d.ref'=>'Text','d.date_debut'=>'Date','d.date_fin'=>'Date','d.date_create'=>'Date','d.date_approve'=>'Date', 'd.rowid'=>"Numeric",'d.ref'=>'Text','d.date_debut'=>'Date','d.date_fin'=>'Date','d.date_create'=>'Date','d.date_approve'=>'Date',
'd.total_ht'=>"Numeric",'d.total_tva'=>'Numeric','d.total_ttc'=>'Numeric','d.note_private'=>'Text','d.note_public'=>'Text', 'd.total_ht'=>"Numeric",'d.total_tva'=>'Numeric','d.total_ttc'=>'Numeric',
'd.fk_statut'=>"Numeric",'d.paid'=>'Numeric',
'd.note_private'=>'Text','d.note_public'=>'Text','d.detail_cancel'=>'Text','d.detail_refuse'=>'Text',
'u.lastname'=>'Text','u.firstname'=>'Text','u.login'=>"Text",'ed.rowid'=>'Numeric','tf.code'=>'Code','ed.date'=>'Date','ed.tva_tx'=>'Numeric', 'u.lastname'=>'Text','u.firstname'=>'Text','u.login'=>"Text",'ed.rowid'=>'Numeric','tf.code'=>'Code','ed.date'=>'Date','ed.tva_tx'=>'Numeric',
'ed.total_ht'=>'Numeric','ed.total_tva'=>'Numeric','ed.total_ttc'=>'Numeric','ed.comments'=>'Text','p.rowid'=>'Numeric','p.ref'=>'Text', 'ed.total_ht'=>'Numeric','ed.total_tva'=>'Numeric','ed.total_ttc'=>'Numeric','ed.comments'=>'Text','p.rowid'=>'Numeric','p.ref'=>'Text',
'user_rib.iban_prefix' => 'Text', 'user_rib.bic' => 'Text', 'user_rib.code_banque' => 'Text', 'user_rib.bank' => 'Text', 'user_rib.proprio' => 'Text', 'user_rib.iban_prefix' => 'Text', 'user_rib.bic' => 'Text', 'user_rib.code_banque' => 'Text', 'user_rib.bank' => 'Text', 'user_rib.proprio' => 'Text',

View File

@ -390,7 +390,7 @@ class modProduct extends DolibarrModules
'p.length' => "Length", 'p.length' => "Length",
'p.length_units' => "LengthUnit", 'p.length_units' => "LengthUnit",
'p.width' => "Width", 'p.width' => "Width",
'p.width_units' => "VolumeUnits", 'p.width_units' => "WidthUnits",
'p.height' => "Height", 'p.height' => "Height",
'p.height_units' => "HeightUnit", 'p.height_units' => "HeightUnit",
'p.surface' => "Surface", 'p.surface' => "Surface",

View File

@ -360,7 +360,7 @@ class modService extends DolibarrModules
'p.length' => "Length", 'p.length' => "Length",
'p.length_units' => "LengthUnit", 'p.length_units' => "LengthUnit",
'p.width' => "Width", 'p.width' => "Width",
'p.width_units' => "VolumeUnits", 'p.width_units' => "WidthUnits",
'p.height' => "Height", 'p.height' => "Height",
'p.height_units' => "HeightUnit", 'p.height_units' => "HeightUnit",
'p.surface' => "Surface", 'p.surface' => "Surface",

View File

@ -151,7 +151,7 @@ ErrorBillNotFound=Invoice %s does not exist
ErrorInvoiceAlreadyReplaced=Error, you tried to validate an invoice to replace invoice %s. But this one has already been replaced by invoice %s. ErrorInvoiceAlreadyReplaced=Error, you tried to validate an invoice to replace invoice %s. But this one has already been replaced by invoice %s.
ErrorDiscountAlreadyUsed=Error, discount already used ErrorDiscountAlreadyUsed=Error, discount already used
ErrorInvoiceAvoirMustBeNegative=Error, correct invoice must have a negative amount ErrorInvoiceAvoirMustBeNegative=Error, correct invoice must have a negative amount
ErrorInvoiceOfThisTypeMustBePositive=Error, this type of invoice must have a positive amount ErrorInvoiceOfThisTypeMustBePositive=Error, this type of invoice must have an amount excluding tax positive (or null)
ErrorCantCancelIfReplacementInvoiceNotValidated=Error, can't cancel an invoice that has been replaced by another invoice that is still in draft status ErrorCantCancelIfReplacementInvoiceNotValidated=Error, can't cancel an invoice that has been replaced by another invoice that is still in draft status
ErrorThisPartOrAnotherIsAlreadyUsedSoDiscountSerieCantBeRemoved=This part or another is already used so discount series cannot be removed. ErrorThisPartOrAnotherIsAlreadyUsedSoDiscountSerieCantBeRemoved=This part or another is already used so discount series cannot be removed.
BillFrom=From BillFrom=From
@ -295,7 +295,8 @@ AddGlobalDiscount=Create absolute discount
EditGlobalDiscounts=Edit absolute discounts EditGlobalDiscounts=Edit absolute discounts
AddCreditNote=Create credit note AddCreditNote=Create credit note
ShowDiscount=Show discount ShowDiscount=Show discount
ShowReduc=Show the deduction ShowReduc=Show the discount
ShowSourceInvoice=Show the source invoice
RelativeDiscount=Relative discount RelativeDiscount=Relative discount
GlobalDiscount=Global discount GlobalDiscount=Global discount
CreditNote=Credit note CreditNote=Credit note

View File

@ -189,8 +189,10 @@ if ($action == 'valid' && $user->rights->facture->creer)
$res = $invoice->validate($user); $res = $invoice->validate($user);
} }
$remaintopay = $invoice->getRemainToPay();
// Add the payment // Add the payment
if ($res > 0) { if ($res >= 0 && $remaintopay > 0) {
$payment = new Paiement($db); $payment = new Paiement($db);
$payment->datepaye = $now; $payment->datepaye = $now;
$payment->fk_account = $bankaccount; $payment->fk_account = $bankaccount;
@ -205,9 +207,9 @@ if ($action == 'valid' && $user->rights->facture->creer)
$payment->create($user); $payment->create($user);
$payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', ''); $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', '');
$remaintopay = $invoice->getRemainToPay(); $remaintopay = $invoice->getRemainToPay(); // Recalculate remain to pay after the payment is recorded
if ($remaintopay == 0) { if ($remaintopay == 0) {
dol_syslog("Invoice is paid, so we set it to pay"); dol_syslog("Invoice is paid, so we set it to status Paid");
$result = $invoice->set_paid($user); $result = $invoice->set_paid($user);
if ($result > 0) $invoice->paye = 1; if ($result > 0) $invoice->paye = 1;
} else { } else {