Merge pull request #10867 from aspangaro/9.0_various

FIX: Error with various & salary payment on project
This commit is contained in:
Laurent Destailleur 2019-03-18 09:00:26 +01:00 committed by GitHub
commit e4ed5999eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015-2018 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2015-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016 Josep Lluís Amador <joseplluis@lliuretic.cat>
*
@ -419,7 +419,7 @@ $listofreferent=array(
'name'=>"SocialContribution",
'title'=>"ListSocialContributionAssociatedProject",
'class'=>'ChargeSociales',
'margin'=>'add',
'margin'=>'minus',
'table'=>'chargesociales',
'datefieldname'=>'date_ech',
'disableamount'=>0,
@ -470,7 +470,7 @@ $listofreferent=array(
'datefieldname'=>'datev',
'margin'=>'minus',
'disableamount'=>0,
'urlnew'=>DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&projectid='.$id.'&socid='.$socid,
'urlnew'=>DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&projectid='.$id,
'lang'=>'banks',
'buttonnew'=>'AddVariousPayment',
'testnew'=>$user->rights->banque->modifier,
@ -602,7 +602,7 @@ foreach ($listofreferent as $key => $value)
// Special cases
if ($tablename != 'expensereport_det' && method_exists($element, 'fetch_thirdparty')) $element->fetch_thirdparty();
if ($tablename == 'don' || $tablename == 'chargesociales') $total_ht_by_line=$element->amount;
if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'payment_salary') $total_ht_by_line=$element->amount;
elseif ($tablename == 'stock_mouvement') $total_ht_by_line=$element->price*abs($element->qty);
else if($tablename == 'fichinter') $total_ht_by_line=$element->getAmount();
elseif ($tablename == 'projet_task')
@ -632,8 +632,8 @@ foreach ($listofreferent as $key => $value)
if ($qualifiedfortotal) $total_ht = $total_ht + $total_ht_by_line;
if ($tablename == 'don' || $tablename == 'chargesociales') $total_ttc_by_line=$element->amount;
else if($tablename == 'fichinter') $total_ttc_by_line=$element->getAmount();
if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'payment_salary') $total_ttc_by_line=$element->amount;
elseif ($tablename == 'fichinter') $total_ttc_by_line=$element->getAmount();
elseif ($tablename == 'stock_mouvement') $total_ttc_by_line=$element->price*abs($element->qty);
elseif ($tablename == 'projet_task')
{