From 644f247910b7c9fbd24e370ec4fb2a942c760be4 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Mon, 13 May 2019 12:02:46 +0200 Subject: [PATCH 1/6] fix useless calculation --- htdocs/core/class/html.formmargin.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index da8acce83d4..72352bc5bdb 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -91,7 +91,7 @@ class FormMargin $line->pa_ht = $line->subprice * (1 - ($line->remise_percent / 100)); } - $pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100); + $pv = $line->total_ht; $pa_ht = ($pv < 0 ? - $line->pa_ht : $line->pa_ht); // We choosed to have line->pa_ht always positive in database, so we guess the correct sign $pa = $line->qty * $pa_ht; From 2a2f0557cf9b89ded64860458e1ebaa3c0f2db37 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 17 May 2019 17:02:44 +0200 Subject: [PATCH 2/6] Fix : display hr tab on user if rights to read all --- htdocs/core/lib/usergroups.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 81989d0aaa1..efe0dbb52bd 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -144,8 +144,8 @@ function user_prepare_head($object) if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) || (! empty($conf->hrm->enabled) && ! empty($user->rights->hrm->employee->read)) - || (! empty($conf->expensereport->enabled) && ! empty($user->rights->expensereport->lire) && $user->id == $object->id) - || (! empty($conf->holiday->enabled) && ! empty($user->rights->holiday->read) && $user->id == $object->id ) + || (! empty($conf->expensereport->enabled) && ! empty($user->rights->expensereport->lire) && ($user->id == $object->id || $user->rights->expensereport->readall)) + || (! empty($conf->holiday->enabled) && ! empty($user->rights->holiday->read) && ($user->id == $object->id || $user->rights->holiday->read_all)) ) { // Bank From 1af69d4c8f8e4efe1b58f1c67cd2200ef6ee8180 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 18 May 2019 00:40:29 +0200 Subject: [PATCH 3/6] Fix varnames in invoice api --- htdocs/compta/facture/class/api_invoices.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 6fe44440ff5..87377662a62 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -72,10 +72,10 @@ class Invoices extends DolibarrApi } // Get payment details - $this->invoice->totalpaye = $this->invoice->getSommePaiement(); + $this->invoice->totalpaid = $this->invoice->getSommePaiement(); $this->invoice->totalcreditnotes = $this->invoice->getSumCreditNotesUsed(); $this->invoice->totaldeposits = $this->invoice->getSumDepositsUsed(); - $this->invoice->resteapayer = price2num($this->invoice->total_ttc - $this->invoice->totalpaye - $this->invoice->totalcreditnotes - $this->invoice->totaldeposits, 'MT'); + $this->invoice->remaintopay = price2num($this->invoice->total_ttc - $this->invoice->totalpaye - $this->invoice->totalcreditnotes - $this->invoice->totaldeposits, 'MT'); if (! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); From aed71be7f11b7ef590563e60f3585aadba66c0aa Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 18 May 2019 00:47:32 +0200 Subject: [PATCH 4/6] Fix resource delete with attached file --- htdocs/resource/class/dolresource.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index ec184cd856d..ba962bf48c1 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -408,6 +408,7 @@ class Dolresource extends CommonObject function delete($rowid, $notrigger=0) { global $user,$langs,$conf; + require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; $error=0; From 68118e55dc4e5a5154243f9bb74dc6d1e98a3ddd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 May 2019 00:58:43 +0200 Subject: [PATCH 5/6] Update api_invoices.class.php --- htdocs/compta/facture/class/api_invoices.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 87377662a62..d6103f4085c 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -75,7 +75,7 @@ class Invoices extends DolibarrApi $this->invoice->totalpaid = $this->invoice->getSommePaiement(); $this->invoice->totalcreditnotes = $this->invoice->getSumCreditNotesUsed(); $this->invoice->totaldeposits = $this->invoice->getSumDepositsUsed(); - $this->invoice->remaintopay = price2num($this->invoice->total_ttc - $this->invoice->totalpaye - $this->invoice->totalcreditnotes - $this->invoice->totaldeposits, 'MT'); + $this->invoice->remaintopay = price2num($this->invoice->total_ttc - $this->invoice->totalpaid - $this->invoice->totalcreditnotes - $this->invoice->totaldeposits, 'MT'); if (! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); From 095fd2769a3ed6f4b4d0a9b1db180b5afca08972 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 18 May 2019 01:11:34 +0200 Subject: [PATCH 6/6] Fix project beluga order status --- htdocs/core/modules/project/doc/pdf_beluga.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index d7cae4726c5..562f6a093dc 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -273,7 +273,7 @@ class pdf_beluga extends ModelePDFProjects 'table'=>'commande', 'datefieldname'=>'date_commande', 'test'=>$conf->commande->enabled && $user->rights->commande->lire, - 'lang'=>'order'), + 'lang'=>'orders'), 'invoice'=>array( 'name'=>"CustomersInvoices", 'title'=>"ListInvoicesAssociatedProject",