diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index c1a62847b32..9633157b5b7 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -3,7 +3,7 @@ * Copyright (C) 2007-2010 Jean Heimburger * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2013-2018 Alexandre Spangaro + * Copyright (C) 2013-2021 Alexandre Spangaro * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2018 Frédéric France @@ -627,7 +627,7 @@ if (empty($action) || $action == 'view') { print "".$expensereportstatic->getNomUrl(1).""; // Account print ""; - $accountoshow = length_accounta($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT); + $accountoshow = length_accountg($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT); if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("MainAccountForUsersNotDefined").''; } else { diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 71358770775..9a65844871d 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -3,7 +3,7 @@ * Copyright (C) 2007-2010 Jean Heimburger * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2021 Alexandre Spangaro * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2018 Frédéric France @@ -648,7 +648,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"'.$val["refsologest"].'"'.$sep; print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep; print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; - print '"'.$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER.'"'.$sep; + print '"'.length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER).'"'.$sep; print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; print '"'.$langs->trans("Thirdparty").'"'.$sep; print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$val["refsuppliersologest"].' - '.$langs->trans("Thirdparty").'"'.$sep; @@ -717,9 +717,9 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"'.$date.'"'.$sep; print '"'.$val["refsologest"].'"'.$sep; print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep; - print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; - print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; - print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; + print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; + print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; + print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; print '"'.$langs->trans("Thirdparty").'"'.$sep; print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$val["refsuppliersologest"].' - '.$langs->trans("VAT").' NPR"'.$sep; print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep; @@ -894,7 +894,7 @@ if (empty($action) || $action == 'view') { print "".$invoicestatic->getNomUrl(1).""; // Account print ""; - $accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER); + $accountoshow = length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER); if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("MainAccountForSuppliersNotDefined").''; } else { diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 93be8e8b1b9..bd476173427 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -609,7 +609,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"'.$val["ref"].'"'.$sep; print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep; print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; - print '"'.$conf->global->ACCOUNTING_ACCOUNT_CUSTOMER.'"'.$sep; + print '"'.length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER).'"'.$sep; print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; print '"'.$langs->trans("Thirdparty").'"'.$sep; print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$invoicestatic->ref.' - '.$langs->trans("Thirdparty").'"'.$sep; @@ -834,7 +834,7 @@ if (empty($action) || $action == 'view') { print "".$invoicestatic->getNomUrl(1).""; // Account print ""; - $accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER); + $accountoshow = length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER); if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("MainAccountForCustomersNotDefined").''; } else { diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 42aab7a9cf8..2603b520c77 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -106,10 +106,16 @@ print load_fiche_titre($langs->trans("CommercialArea"), '', 'commercial'); print '
'; -print getCustomerProposalPieChart($socid); -print '
'; -print getCustomerOrderPieChart($socid); -print '
'; +$tmp = getCustomerProposalPieChart($socid); +if ($tmp) { + print $tmp; + print '
'; +} +$tmp = getCustomerOrderPieChart($socid); +if ($tmp) { + print $tmp; + print '
'; +} /* * Draft customer proposals diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index e080e36b49c..de2e4a1d64c 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -67,8 +67,11 @@ print load_fiche_titre($langs->trans("ProspectionArea"), '', 'propal'); print '
'; print '
'; -print getCustomerProposalPieChart($socid); -print '
'; +$tmp = getCustomerProposalPieChart($socid); +if ($tmp) { + print $tmp; + print '
'; +} /* * Draft proposals diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index f7dee2b4062..a794d79e743 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -77,8 +77,11 @@ print load_fiche_titre($langs->trans("OrdersArea"), '', 'order'); print '
'; -print getCustomerOrderPieChart($socid); -print '
'; +$tmp = getCustomerOrderPieChart($socid); +if ($tmp) { + print $tmp; + print '
'; +} /* diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 0e1ff6b405b..31de2bbd4ff 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -321,8 +321,8 @@ if (empty($reshook)) { //var_dump($array_of_total_ht_per_vat_rate);exit; foreach ($array_of_total_ht_per_vat_rate as $vatrate => $tmpvalue) { - $tmp_total_ht = $array_of_total_ht_per_vat_rate[$vatrate]; - $tmp_total_ht_devise = $array_of_total_ht_devise_per_vat_rate[$vatrate]; + $tmp_total_ht = price2num($array_of_total_ht_per_vat_rate[$vatrate]); + $tmp_total_ht_devise = price2num($array_of_total_ht_devise_per_vat_rate[$vatrate]); if (($tmp_total_ht < 0 || $tmp_total_ht_devise < 0) && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) { if ($object->type == $object::TYPE_DEPOSIT) { diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 42262b60358..67d59ceb531 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -293,7 +293,7 @@ class Facture extends CommonInvoice 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>1), 'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>5), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1), - 'ref_client' =>array('type'=>'varchar(255)', 'label'=>'Ref client', 'enabled'=>1, 'visible'=>-1, 'position'=>10), + 'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>10), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>12), //'ref_int' =>array('type'=>'varchar(255)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>0, 'position'=>30), // deprecated 'type' =>array('type'=>'smallint(6)', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15), @@ -343,8 +343,8 @@ class Facture extends CommonInvoice 'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Currency', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>280), 'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'CurrencyRate', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>285, 'isameasure'=>1), 'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountHT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>290, 'isameasure'=>1), - 'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>295, 'isameasure'=>1), - 'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>300, 'isameasure'=>1), + 'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>291, 'isameasure'=>1), + 'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>292, 'isameasure'=>1), 'fk_fac_rec_source' =>array('type'=>'integer', 'label'=>'RecurringInvoiceSource', 'enabled'=>1, 'visible'=>-1, 'position'=>305), 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>-1, 'position'=>310), 'module_source' =>array('type'=>'varchar(32)', 'label'=>'POSModule', 'enabled'=>1, 'visible'=>-1, 'position'=>315), diff --git a/htdocs/compta/facture/index.php b/htdocs/compta/facture/index.php index 66a2fccaf08..d3d3a33acb5 100644 --- a/htdocs/compta/facture/index.php +++ b/htdocs/compta/facture/index.php @@ -59,19 +59,33 @@ print load_fiche_titre($langs->trans("CustomersInvoicesArea"), '', 'bill'); print '
'; print '
'; -print getNumberInvoicesPieChart('customers'); -//print getCustomerInvoicePieChart($socid); -print '
'; -print getCustomerInvoiceDraftTable($max, $socid); +$tmp = getNumberInvoicesPieChart('customers'); +if ($tmp) { + print $tmp; + print '
'; +} +$tmp = getCustomerInvoiceDraftTable($max, $socid); +if ($tmp) { + print $tmp; + print '
'; +} print '
'; print '
'; print '
'; -print getCustomerInvoiceLatestEditTable($maxLatestEditCount, $socid); -print '
'; -print getCustomerInvoiceUnpaidOpenTable($max, $socid); +$tmp = getCustomerInvoiceLatestEditTable($maxLatestEditCount, $socid); +if ($tmp) { + print $tmp; + print '
'; +} + +$tmp = getCustomerInvoiceUnpaidOpenTable($max, $socid); +if ($tmp) { + print $tmp; + print '
'; +} print '
'; print '
'; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 537548060b0..cd274c686a9 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -235,13 +235,13 @@ $arrayfields = array( 'rtp'=>array('label'=>"Rest", 'checked'=>0, 'position'=>150), // Not enabled by default because slow 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>165), 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>166), - 'f.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>170), - 'f.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>171), - 'f.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>180), - 'f.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>190), - 'f.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>200), - 'multicurrency_dynamount_payed'=>array('label'=>'MulticurrencyAlreadyPaid', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>210), - 'multicurrency_rtp'=>array('label'=>'MulticurrencyRemainderToPay', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>220), // Not enabled by default because slow + 'f.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>280), + 'f.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>285), + 'f.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>290), + 'f.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>291), + 'f.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>292), + 'multicurrency_dynamount_payed'=>array('label'=>'MulticurrencyAlreadyPaid', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>295), + 'multicurrency_rtp'=>array('label'=>'MulticurrencyRemainderToPay', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>296), // Not enabled by default because slow 'total_pa' => array('label' => ($conf->global->MARGIN_TYPE == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)), 'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)), 'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)), diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index f951a3dc198..02972f39630 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -99,7 +99,8 @@ class FormMargin $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 - if ($object->element == 'facture' && $object->type == $object::TYPE_SITUATION) { + if (($object->element == 'facture' && $object->type == $object::TYPE_SITUATION) + || ($object->element == 'facture' && $object->type == $object::TYPE_CREDIT_NOTE && $conf->global->INVOICE_USE_SITUATION_CREDIT_NOTE && $object->situation_counter > 0)) { $pa = $line->qty * $pa_ht * ($line->situation_percent / 100); } else { $pa = $line->qty * $pa_ht; diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 4be6aa8379e..8f6a97894b9 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -679,7 +679,8 @@ function getCustomerInvoiceDraftTable($maxCount = 500, $socid = 0) $companystatic->code_compta = $obj->code_compta; $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur; - $result .= ''; + $result .= ''; + $result .= ''; $result .= $tmpinvoice->getNomUrl(1, ''); $result .= ''; $result .= ''; @@ -807,7 +808,8 @@ function getDraftSupplierTable($maxCount = 500, $socid = 0) $companystatic->code_compta = $obj->code_compta; $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur; - $result .= ''; + $result .= ''; + $result .= ''; $result .= $facturesupplierstatic->getNomUrl(1, ''); $result .= ''; $result .= ''; @@ -883,7 +885,9 @@ function getCustomerInvoiceLatestEditTable($maxCount = 5, $socid = 0) $result .= ''; $result .= ''; - $result .= ''; + $result .= ''; + $result .= ''; + $result .= ''; $result .= ''; if ($num < 1) { @@ -917,7 +921,7 @@ function getCustomerInvoiceLatestEditTable($maxCount = 5, $socid = 0) $filename = dol_sanitizeFileName($obj->ref); $filedir = $conf->propal->multidir_output[$obj->entity].'/'.$filename; - $result .= ''; + $result .= ''; $result .= ''; - $result .= ''; + $result .= ''; $result .= ''; + $result .= ''; $result .= ''; $result .= ''; @@ -985,7 +990,9 @@ function getPurchaseInvoiceLatestEditTable($maxCount = 5, $socid = 0) $result = '
'; $result .= '
'.$langs->trans("LastCustomersBills", $maxCount).''.$langs->trans("LastCustomersBills", $maxCount).''.$langs->trans("AmountTTC").'
'; $result .= ''; @@ -931,8 +935,9 @@ function getCustomerInvoiceLatestEditTable($maxCount = 5, $socid = 0) $result .= '
'; $result .= '
'.$companystatic->getNomUrl(1, 'customer').''.$companystatic->getNomUrl(1, 'customer').''.dol_print_date($db->jdate($obj->datec), 'day').''.price($obj->total_ttc).''.$objectstatic->getLibStatut(5).'
'; $result .= ''; - $result .= ''; + $result .= ''; + $result .= ''; + $result .= ''; $result .= ''; if ($num < 1) { @@ -1019,7 +1026,7 @@ function getPurchaseInvoiceLatestEditTable($maxCount = 5, $socid = 0) $filename = dol_sanitizeFileName($obj->ref); $filedir = $conf->propal->multidir_output[$obj->entity].'/'.$filename; - $result .= ''; + $result .= ''; $result .= ''; - $result .= ''; + $result .= ''; + $result .= ''; + + $result .= ''; + $result .= ''; $result .= ''; @@ -1341,7 +1352,8 @@ function getPurchaseInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0) $societestatic->code_compta = $obj->code_compta; $societestatic->code_compta_fournisseur = $obj->code_compta_fournisseur; - print ''; + print ''; print ''; diff --git a/htdocs/don/index.php b/htdocs/don/index.php index 2a314068830..e7aaeb8a4bd 100644 --- a/htdocs/don/index.php +++ b/htdocs/don/index.php @@ -174,8 +174,8 @@ foreach ($listofstatus as $status) { print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; $totalnb += (!empty($nb[$status]) ? $nb[$status] : 0); $total += (!empty($somme[$status]) ? $somme[$status] : 0); print ""; @@ -183,9 +183,9 @@ foreach ($listofstatus as $status) { print ''; print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; print ''; print "
'.$langs->trans("BoxTitleLastSupplierBills", $maxCount).''.$langs->trans("BoxTitleLastSupplierBills", $maxCount).''.$langs->trans("AmountTTC").'
'; $result .= ''; @@ -1033,8 +1040,12 @@ function getPurchaseInvoiceLatestEditTable($maxCount = 5, $socid = 0) $result .= '
'; $result .= '
'.$companystatic->getNomUrl(1, 'supplier').''.$companystatic->getNomUrl(1, 'supplier').''.dol_print_date($db->jdate($obj->datec), 'day').''.price($obj->total_ttc).''.$objectstatic->getLibStatut(5).'
'; + print '
'; print $facstatic->getNomUrl(1, ''); print ''.$societestatic->getNomUrl(1, 'supplier').'
'.$donstatic->LibStatut($status, 4).''.(!empty($nb[$status]) ? $nb[$status] : ' ').''.(!empty($nb[$status]) ?price($somme[$status], 'MT') : ' ').''.(!empty($nb[$status]) ?price(price2num($somme[$status] / $nb[$status], 'MT')) : ' ').''.(!empty($nb[$status]) ? price($somme[$status], 'MT') : ' ').''.(!empty($nb[$status]) ?price(price2num($somme[$status] / $nb[$status], 'MT')) : ' ').'
'.$langs->trans("Total").''.$totalnb.''.price($total, 'MT').''.($totalnb ?price(price2num($total / $totalnb, 'MT')) : ' ').''.$totalnb.''.price($total, 'MT').''.($totalnb ?price(price2num($total / $totalnb, 'MT')) : ' ').'
"; @@ -233,7 +233,7 @@ if ($resql) { print dolGetFirstLastname($obj->lastname, $obj->firstname); print ''; - print ''; + print ''; print price($obj->amount, 1); print ''; diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index 9a664489e4f..28ef8025a98 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -223,10 +223,10 @@ class PaiementFourn extends Paiement // If we want to closed paid invoices if ($closepaidinvoices) { $paiement = $invoice->getSommePaiement(); - //$creditnotes=$invoice->getSumCreditNotesUsed(); - $creditnotes = 0; - //$deposits=$invoice->getSumDepositsUsed(); - $deposits = 0; + $creditnotes=$invoice->getSumCreditNotesUsed(); + //$creditnotes = 0; + $deposits=$invoice->getSumDepositsUsed(); + //$deposits = 0; $alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT'); $remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT'); if ($remaintopay == 0) { @@ -238,7 +238,7 @@ class PaiementFourn extends Paiement // Insert one discount by VAT rate category require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php'; $discount = new DiscountAbsolute($this->db); - $discount->fetch('', $invoice->id); + $discount->fetch('', 0, $invoice->id); if (empty($discount->id)) { // If the invoice was not yet converted into a discount (this may have been done manually before we come here) $discount->discount_type = 1; // Supplier discount $discount->description = '(DEPOSIT)'; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 2614c5cede0..6ea356e189e 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2478,7 +2478,7 @@ if ($action == 'create') { $labelofbutton = $langs->trans('ReceiveProducts'); if ($conf->reception->enabled) { $labelofbutton = $langs->trans("CreateReception"); - if (!empty($object->linkedObjects)) { + if (!empty($object->linkedObjects['reception'])) { foreach ($object->linkedObjects['reception'] as $element) { if ($element->statut >= 0) { $hasreception = 1; diff --git a/htdocs/fourn/facture/index.php b/htdocs/fourn/facture/index.php index c695eed9285..5479ad22462 100644 --- a/htdocs/fourn/facture/index.php +++ b/htdocs/fourn/facture/index.php @@ -58,19 +58,34 @@ print load_fiche_titre($langs->trans("SupplierInvoicesArea"), '', 'supplier_invo print '
'; print '
'; -print getNumberInvoicesPieChart('suppliers'); -//print getPurchaseInvoicePieChart($socid); -print '
'; -print getDraftSupplierTable($maxDraftCount, $socid); +$tmp = getNumberInvoicesPieChart('suppliers'); +if ($tmp) { + print $tmp; + print '
'; +} + +$tmp = getDraftSupplierTable($maxDraftCount, $socid); +if ($tmp) { + print $tmp; + print '
'; +} print '
'; print '
'; print '
'; -print getPurchaseInvoiceLatestEditTable($maxLatestEditCount, $socid); -print '
'; -print getPurchaseInvoiceUnpaidOpenTable($max, $socid); +$tmp = getPurchaseInvoiceLatestEditTable($maxLatestEditCount, $socid); +if ($tmp) { + print $tmp; + print '
'; +} + +$tmp = getPurchaseInvoiceUnpaidOpenTable($max, $socid); +if ($tmp) { + print $tmp; + print '
'; +} print '
'; print '
'; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index d92cdd8ce05..0d34a3790df 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -170,29 +170,29 @@ if (empty($user->socid)) { $checkedtypetiers = 0; $arrayfields = array( - 'f.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), - 'f.ref_supplier'=>array('label'=>$langs->trans("RefSupplier"), 'checked'=>1), - 'f.type'=>array('label'=>$langs->trans("Type"), 'checked'=>0), - 'f.label'=>array('label'=>$langs->trans("Label"), 'checked'=>0), - 'f.datef'=>array('label'=>$langs->trans("DateInvoice"), 'checked'=>1), - 'f.date_lim_reglement'=>array('label'=>$langs->trans("DateDue"), 'checked'=>1), - 'p.ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>0), - 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), - 's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>-1), - 's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1), - 'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0), - 'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0), - 'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers), - 'f.fk_cond_reglement'=>array('label'=>$langs->trans("PaymentTerm"), 'checked'=>1, 'position'=>50), - 'f.fk_mode_reglement'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>1, 'position'=>52), - 'f.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1, 'position'=>105), - 'f.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0, 'position'=>110), + 'f.ref'=>array('label'=>"Ref", 'checked'=>1), + 'f.ref_supplier'=>array('label'=>"RefSupplier", 'checked'=>1), + 'f.type'=>array('label'=>"Type", 'checked'=>0), + 'f.label'=>array('label'=>"Label", 'checked'=>0), + 'f.datef'=>array('label'=>"DateInvoice", 'checked'=>1), + 'f.date_lim_reglement'=>array('label'=>"DateDue", 'checked'=>1), + 'p.ref'=>array('label'=>"ProjectRef", 'checked'=>0), + 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1), + 's.town'=>array('label'=>"Town", 'checked'=>-1), + 's.zip'=>array('label'=>"Zip", 'checked'=>1), + 'state.nom'=>array('label'=>"StateShort", 'checked'=>0), + 'country.code_iso'=>array('label'=>"Country", 'checked'=>0), + 'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers), + 'f.fk_cond_reglement'=>array('label'=>"PaymentTerm", 'checked'=>1, 'position'=>50), + 'f.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>1, 'position'=>52), + 'f.total_ht'=>array('label'=>"AmountHT", 'checked'=>1, 'position'=>105), + 'f.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0, 'position'=>110), 'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>$mysoc->localtax1_assuj == "1", 'position'=>95), 'f.total_localtax2'=>array('label'=>$langs->transcountry("AmountLT2", $mysoc->country_code), 'checked'=>0, 'enabled'=>$mysoc->localtax2_assuj == "1", 'position'=>100), - 'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0, 'position'=>115), + 'f.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0, 'position'=>115), 'u.login'=>array('label'=>"Author", 'checked'=>1), - 'dynamount_payed'=>array('label'=>$langs->trans("Payed"), 'checked'=>0), - 'rtp'=>array('label'=>$langs->trans("Rest"), 'checked'=>0), + 'dynamount_payed'=>array('label'=>"Paid", 'checked'=>0), + 'rtp'=>array('label'=>"Rest", 'checked'=>0), 'f.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), 'f.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), 'f.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), @@ -200,9 +200,9 @@ $arrayfields = array( 'f.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), 'multicurrency_dynamount_payed'=>array('label'=>'MulticurrencyAlreadyPaid', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), 'multicurrency_rtp'=>array('label'=>'MulticurrencyRemainderToPay', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), // Not enabled by default because slow - 'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), - 'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), - 'f.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), + 'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), + 'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), + 'f.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), ); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index dd8e75eee3c..5d426485769 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1637,7 +1637,7 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action == 'showlog_defaul } print ''; - if ($candelete) { + if ($candelete || ($db->jdate($objp->dp) >= dol_now())) { // Test on date is to be able to delete a corrupted record with a date in future print 'id.'&lineid='.$objp->rowid.'">'; print img_delete(); print ''; diff --git a/htdocs/projet/class/taskstats.class.php b/htdocs/projet/class/taskstats.class.php index d60868b5ebb..1eb6fda915f 100644 --- a/htdocs/projet/class/taskstats.class.php +++ b/htdocs/projet/class/taskstats.class.php @@ -60,7 +60,7 @@ class TaskStats extends Stats $sql .= " COUNT(t.rowid), t.priority"; $sql .= " FROM ".MAIN_DB_PREFIX."projet_task as t INNER JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = t.fk_projet"; if (!$user->rights->societe->client->voir && !$user->soc_id) { - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=".((int) $user->id); + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc=p.fk_soc AND sc.fk_user=".((int) $user->id); } $sql .= $this->buildWhere(); //$sql .= " AND t.fk_statut <> 0"; // We want historic also, so all task not draft @@ -119,7 +119,7 @@ class TaskStats extends Stats $sql = "SELECT date_format(t.datec,'%Y') as year, COUNT(t.rowid) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."projet_task as t INNER JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = t.fk_projet"; if (!$user->rights->societe->client->voir && !$user->soc_id) { - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=".((int) $user->id); + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc=p.fk_soc AND sc.fk_user=".((int) $user->id); } $sql .= $this->buildWhere(); $sql .= " GROUP BY year"; @@ -181,7 +181,7 @@ class TaskStats extends Stats $sql = "SELECT date_format(t.datec,'%m') as dm, COUNT(t.rowid) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."projet_task as t INNER JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = t.fk_projet"; if (!$user->rights->societe->client->voir && !$user->soc_id) { - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=".((int) $user->id); + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc=p.fk_soc AND sc.fk_user=".((int) $user->id); } $sql .= $this->buildWhere(); $sql .= " GROUP BY dm"; diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index cb2802da385..5f996e6f37d 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -384,7 +384,7 @@ if (empty($elementTypeArray) && !$object->client && !$object->fournisseur) { // Define type of elements $typeElementString = $form->selectarray("type_element", $elementTypeArray, GETPOST('type_element'), $showempty, 0, 0, '', 0, 0, $disabled, '', 'maxwidth150onsmartphone'); -$button = ''; +$button = ''; $param = ''; $param .= "&sref=".urlencode($sref);