';
@@ -2428,7 +2428,7 @@ if ($action == 'create')
}
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
-
+
// Date invoice
print '
";
}
}
@@ -3336,9 +3336,9 @@ else if ($id > 0 || ! empty($ref))
$prevsits_total_amount += $object->total_ht;
print price($prevsits_total_amount, 0, $langs, 1, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency) );
-
+
print '';
-
+
// Previous situation(s) deduction(s)
for ($i = 0; $i < $cprevsits; $i++) {
@@ -3352,7 +3352,7 @@ else if ($id > 0 || ! empty($ref))
print '
';
-
+
}
}
}
@@ -3390,21 +3390,21 @@ else if ($id > 0 || ! empty($ref))
print '
';
print '
';
print '
';
-
+
print '
';
-
+
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
{
// Multicurrency Amount HT
print '| ' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . ' | ';
print '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' | ';
print '
';
-
+
// Multicurrency Amount VAT
print '| ' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . ' | ';
print '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' | ';
print '
';
-
+
// Multicurrency Amount TTC
print '| ' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . ' | ';
print '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' | ';
@@ -3463,7 +3463,7 @@ else if ($id > 0 || ! empty($ref))
print '
';
-
+
// List of previous situation invoices
$sign = 1;
@@ -3486,12 +3486,12 @@ else if ($id > 0 || ! empty($ref))
$nbrows += 5;
if (! empty($conf->incoterm->enabled))
$nbrows += 1;
-
- if ($object->type == Facture::TYPE_SITUATION && ! empty($conf->global->INVOICE_USE_SITUATION))
+
+ if ($object->type == Facture::TYPE_SITUATION && ! empty($conf->global->INVOICE_USE_SITUATION))
{
if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0)
print '
';
-
+
if (count($object->tab_previous_situation_invoice) > 0) {
// List of previous invoices
print '';
@@ -3503,7 +3503,7 @@ else if ($id > 0 || ! empty($ref))
print '| ' . $langs->trans('AmountTTC') . ' | ';
print ' | ';
print '
';
-
+
$total_prev_ht = $total_prev_ttc = 0;
$var = true;
foreach ($object->tab_previous_situation_invoice as $prev_invoice) {
@@ -3519,10 +3519,10 @@ else if ($id > 0 || ! empty($ref))
print '' . price($prev_invoice->total_ttc) . ' | ';
print '' . $prev_invoice->getLibStatut(3, $totalpaye) . ' | ';
print '';
-
+
$var = ! $var;
}
-
+
print '';
print ' | ';
print '' . price($total_prev_ht) . ' | ';
@@ -3530,7 +3530,7 @@ else if ($id > 0 || ! empty($ref))
print ' | ';
print '
';
}
-
+
if (count($object->tab_next_situation_invoice) > 0) {
// List of next invoices
print '';
@@ -3542,9 +3542,9 @@ else if ($id > 0 || ! empty($ref))
print '| ' . $langs->trans('AmountTTC') . ' | ';
print ' | ';
print '
';
-
+
$total_next_ht = $total_next_ttc = 0;
-
+
$var = true;
foreach ($object->tab_next_situation_invoice as $next_invoice) {
$totalpaye = $next_invoice->getSommePaiement();
@@ -3559,10 +3559,10 @@ else if ($id > 0 || ! empty($ref))
print '' . price($next_invoice->total_ttc) . ' | ';
print '' . $next_invoice->getLibStatut(3, $totalpaye) . ' | ';
print '';
-
+
$var = ! $var;
}
-
+
print '';
print ' | ';
print '' . price($total_next_ht) . ' | ';
@@ -3570,14 +3570,14 @@ else if ($id > 0 || ! empty($ref))
print ' | ';
print '
';
}
-
+
if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0)
print '
';
}
-
+
// List of payments already done
-
+
print '
';
print '';
@@ -3735,7 +3735,7 @@ else if ($id > 0 || ! empty($ref))
// Billed
print '
| ' . $langs->trans("Billed") . ' : | ' . price($object->total_ttc) . ' | |
';
-
+
// Remainder to pay
print '| ';
if ($resteapayeraffiche >= 0)
@@ -3745,11 +3745,11 @@ else if ($id > 0 || ! empty($ref))
print ' : | ';
print '' . price($resteapayeraffiche) . ' | ';
print ' |
';
- }
+ }
else // Credit note
{
$cssforamountpaymentcomplete='';
-
+
// Total already paid back
print '';
print $langs->trans('AlreadyPaidBack');
@@ -3807,15 +3807,15 @@ else if ($id > 0 || ! empty($ref))
{
if ($object->situation_cycle_ref && $object->statut == 0) {
print '';
-
+
print ' ';
-
+
print ' ';
-
+
}
-
+
}
-
-
-
+
+
+
print ' |
\n";
print "
";
-
+
print "\n";
dol_fiche_end();
@@ -3998,7 +3998,7 @@ else if ($id > 0 || ! empty($ref))
//print '
'.$langs->trans("MakeWithdrawRequest").'';
}
}
-
+
// Create payment
if ($object->type != Facture::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0 && $user->rights->facture->paiement) {
if ($objectidnext) {
@@ -4149,7 +4149,7 @@ else if ($id > 0 || ! empty($ref))
// Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('invoice'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
-
+
// Link for paypal payment
if (! empty($conf->paypal->enabled) && $object->statut != 0) {
include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php';
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index b440c012f04..321a4752006 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -4332,7 +4332,7 @@ class Form
* Si vendeur et acheteur dans Communauté européenne et acheteur= entreprise alors TVA par défaut=0. Fin de règle.
* Sinon la TVA proposee par defaut=0. Fin de regle.
* @param bool $options_only Return HTML options lines only (for ajax treatment)
- * @param int $mode 1=Add code into key in select list
+ * @param int $mode 0=Use vat rate as key in combo list, 1=Add VAT code after vat rate into key, -1=Use id of vat line as key
* @return string
*/
function load_tva($htmlname='tauxtva', $selectedrate='', $societe_vendeuse='', $societe_acheteuse='', $idprod=0, $info_bits=0, $type='', $options_only=false, $mode=0)
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index f9f9c8557ee..aa70c2680dd 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -3891,7 +3891,7 @@ function getTaxesFromId($vatrowid)
* @param Societe $buyer Company object
* @param Societe $seller Company object
* @param int $firstparamisid 1 if first param is id into table (use this if you can)
- * @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...)
+ * @return array array(localtax_type1(1-6/0 if not found), rate localtax1, localtax_type1, rate localtax2, accountancycodecust, accountancycodesupp)
*/
function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0)
{
@@ -3927,22 +3927,22 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
{
if (! isOnlyOneLocalTax(1))
{
- return array($obj->localtax1_type, get_localtax($vatrate, $local, $buyer, $seller), $obj->accountancy_code_sell,$obj->accountancy_code_buy);
+ return array($obj->localtax1_type, get_localtax($vatrate, $local, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
}
else
{
- return array($obj->localtax1_type, $obj->localtax1,$obj->accountancy_code_sell,$obj->accountancy_code_buy);
+ return array($obj->localtax1_type, $obj->localtax1,$obj->accountancy_code_sell, $obj->accountancy_code_buy);
}
}
elseif ($local == 2)
{
if (! isOnlyOneLocalTax(2))
{
- return array($obj->localtax2_type, get_localtax($vatrate, $local, $buyer, $seller),$obj->accountancy_code_sell,$obj->accountancy_code_buy);
+ return array($obj->localtax2_type, get_localtax($vatrate, $local, $buyer, $seller),$obj->accountancy_code_sell, $obj->accountancy_code_buy);
}
else
{
- return array($obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy);
+ return array($obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell, $obj->accountancy_code_buy);
}
}
else
@@ -3951,22 +3951,22 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
{
if(! isOnlyOneLocalTax(2))
{
- return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller),$obj->accountancy_code_sell,$obj->accountancy_code_buy);
+ return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller), $obj->accountancy_code_sell,$obj->accountancy_code_buy);
}
else
{
- return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy);
+ return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, $obj->localtax2, $obj->accountancy_code_sell, $obj->accountancy_code_buy);
}
}
else
{
if(! isOnlyOneLocalTax(2))
{
- return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type,get_localtax($vatrate, 2, $buyer, $seller) ,$obj->accountancy_code_sell,$obj->accountancy_code_buy);
+ return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
}
else
{
- return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy);
+ return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, $obj->localtax2, $obj->accountancy_code_sell, $obj->accountancy_code_buy);
}
}
}
diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index c4257c3c7f8..1b79cc9163d 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -1039,10 +1039,10 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
// Show page nb only on iso languages (so default Helvetica font)
if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica')
{
- $pdf->SetXY(-20,-$posy);
+ $pdf->SetXY($dims['wk']-$dims['rm']-15, -$posy);
//print 'xxx'.$pdf->PageNo().'-'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit;
- if (empty($conf->global->MAIN_USE_FPDF)) $pdf->MultiCell(13, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0);
- else $pdf->MultiCell(13, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0);
+ if (empty($conf->global->MAIN_USE_FPDF)) $pdf->MultiCell(15, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0);
+ else $pdf->MultiCell(15, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0);
}
return $marginwithfooter;
@@ -1246,7 +1246,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
if (empty($hideref))
{
- if ($issupplierline)
+ if ($issupplierline)
{
//$ref_prodserv = $prodser->ref.($ref_supplier ? ' ('.$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.')' : ''); // Show local ref and supplier ref
if (! empty($conf->global->PDF_HIDE_PRODUCT_REF_IN_SUPPLIER_LINES)) $ref_prodserv =$ref_supplier;
diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql
index 5aa272380cc..b40eb4bafa9 100644
--- a/htdocs/core/menus/init_menu_auguria.sql
+++ b/htdocs/core/menus/init_menu_auguria.sql
@@ -220,6 +220,8 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2460__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_tax', 2451__+MAX_llx_menu__, '/admin/dict.php?id=7&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuTaxAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 50, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2461__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_expensereport', 2451__+MAX_llx_menu__, '/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuExpenseReportAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 60, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2462__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_product', 2451__+MAX_llx_menu__, '/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuProductsAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 70, __ENTITY__);
+ -- Accounting period
+ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin" && $conf->global->MAIN_FEATURES_LEVEL > 0', __HANDLER__, 'left', 2450__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_period', 2451__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'FiscalPeriod', 1, 'admin', '', '', 2, 80, __ENTITY__);
-- Binding
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2401__+MAX_llx_menu__, 'accountancy', 'dispatch_customer', 2400__+MAX_llx_menu__, '/accountancy/customer/index.php?leftmenu=dispatch_customer', 'CustomersVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="dispatch_customer"', __HANDLER__, 'left', 2402__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/list.php', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 3, __ENTITY__);
@@ -245,8 +247,6 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2445__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/stats/casoc.php?leftmenu=ca', 'ByCompanies', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 22, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2446__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/stats/cabyuser.php?leftmenu=ca', 'ByUsers', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 23, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2447__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/stats/cabyprodserv.php?leftmenu=ca', 'ByProductsAndServices', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 24, __ENTITY__);
- -- Accounting period
- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2450__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_period', 2400__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?mainmenu=setup', 'FiscalPeriod', 1, 'admin', '', '', 2, 4, __ENTITY__);
-- Rapports compta simple
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled', __HANDLER__, 'left', 2700__+MAX_llx_menu__, 'accountancy', 'ca', 6__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca&mainmenu=accountancy', 'Reportings', 0, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 11, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2701__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca', 'ReportInOut', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__);
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index 66fe9f993a9..e96ac4a7193 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -966,7 +966,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{
if (preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/don/admin/donation.php?from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDonationAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_donation', 47);
}*/
- if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 50);
+ if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 50);
+
+ // Fiscal year
+ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // Not yet used. In a future will lock some periods.
+ {
+ if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 2, $user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear');
+ }
// Binding
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&mainmenu=accountancy",$langs->trans("CustomersVentilation"),1,$user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_customer');
@@ -1039,12 +1045,6 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report",$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report",$langs->trans("ByUsers"),3,$user->rights->accounting->comptarapport->lire);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report", $langs->trans("ByProductsAndServices"),3,$user->rights->accounting->comptarapport->lire);
-
- // Fiscal year
- if ($conf->global->MAIN_FEATURES_LEVEL > 0) // Not yet used. In a future will lock some periods.
- {
- if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"),1,$user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear');
- }
}
// Accountancy (simple)
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index 971a2189854..28e47ad4c98 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -49,7 +49,7 @@ class Expedition extends CommonObject
public $table_element_line="expeditiondet";
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $picto = 'sending';
-
+
var $socid;
var $ref_customer;
var $ref_int;
@@ -396,7 +396,7 @@ class Expedition extends CommonObject
{
$error++;
}
-
+
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used
{
$expeditionline = new ExpeditionLigne($this->db);
@@ -915,7 +915,7 @@ class Expedition extends CommonObject
$this->error='ADDLINE_WAS_CALLED_INSTEAD_OF_ADDLINEBATCH';
return -4;
}
-
+
// extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used
$line->array_options = $array_options;
@@ -1316,7 +1316,8 @@ class Expedition extends CommonObject
$sql = "SELECT cd.rowid, cd.fk_product, cd.label as custom_label, cd.description, cd.qty as qty_asked, cd.product_type";
$sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva";
- $sql.= ", cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht";
+ $sql.= ", cd.vat_src_code, cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.localtax1_type, cd.localtax2_type, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht";
+ $sql.= ", cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc";
$sql.= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot";
$sql.= ", p.ref as product_ref, p.label as product_label, p.fk_product_type";
$sql.= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tobatch as product_tobatch";
@@ -1389,8 +1390,10 @@ class Expedition extends CommonObject
$line->pa_ht = $obj->pa_ht;
+ $localtax_array=array(0=>$obj->localtax1_type, 1=>$obj->localtax1_tx, 2=>$obj->localtax2_type, 3=>$obj->localtax2_tx);
+
// For invoicing
- $tabprice = calcul_price_total($obj->qty_shipped, $obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->fk_product_type, $mysoc); // We force type to 0
+ $tabprice = calcul_price_total($obj->qty_shipped, $obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->fk_product_type, $mysoc, $localtax_array); // We force type to 0
$line->desc = $obj->description; // We need ->desc because some code into CommonObject use desc (property defined for other elements)
$line->qty = $line->qty_shipped;
$line->total_ht = $tabprice[0];
@@ -1398,6 +1401,7 @@ class Expedition extends CommonObject
$line->total_localtax2 = $tabprice[10];
$line->total_ttc = $tabprice[2];
$line->total_tva = $tabprice[1];
+ $line->vat_src_code = $obj->vat_src_code;
$line->tva_tx = $obj->tva_tx;
$line->localtax1_tx = $obj->localtax1_tx;
$line->localtax2_tx = $obj->localtax2_tx;
@@ -1411,6 +1415,14 @@ class Expedition extends CommonObject
$this->total_localtax1+= $tabprice[9];
$this->total_localtax2+= $tabprice[10];
+ // Multicurrency
+ $this->fk_multicurrency = $obj->fk_multicurrency;
+ $this->multicurrency_code = $obj->multicurrency_code;
+ $this->multicurrency_subprice = $obj->multicurrency_subprice;
+ $this->multicurrency_total_ht = $obj->multicurrency_total_ht;
+ $this->multicurrency_total_tva = $obj->multicurrency_total_tva;
+ $this->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
+
if ($originline != $obj->fk_origin_line)
{
$line->detail_batch = array();
@@ -1479,7 +1491,7 @@ class Expedition extends CommonObject
$label = '
' . $langs->trans("ShowSending") . '';
$label .= '
' . $langs->trans('Ref') . ': '.$this->ref;
$label .= '
'.$langs->trans('RefCustomer').': '.($this->ref_customer ? $this->ref_customer : $this->ref_client);
-
+
$url = DOL_URL_ROOT.'/expedition/card.php?id='.$this->id;
if ($short) return $url;
@@ -1495,7 +1507,7 @@ class Expedition extends CommonObject
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip"';
}
-
+
$linkstart = '
';
$linkend='';
diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php
index cdd639ad50b..c1083062a5f 100644
--- a/htdocs/install/fileconf.php
+++ b/htdocs/install/fileconf.php
@@ -66,6 +66,7 @@ if (@file_exists($forcedfile)) {
}
+
/*
* View
*/
@@ -426,8 +427,8 @@ if (! empty($force_install_message))
0 && ! empty($force_install_databaserootlogin)) {
print ' disabled';
} ?>
>
@@ -499,26 +500,28 @@ if (! empty($force_install_message))
trans("Password"); ?>
|
+
"
- 0 && ! empty($force_install_databaserootpass)) {
+ print ' disabled'; // May be removed by javascript
} ?>
>
|
@@ -561,7 +564,10 @@ jQuery(document).ready(function() {
if (jQuery("#db_create_database").is(":checked") || jQuery("#db_create_user").is(":checked"))
{
jQuery(".hideroot").show();
- jQuery(".needroot").removeAttr('disabled');
+
+ jQuery(".needroot").removeAttr('disabled');
+
}
else
{
diff --git a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql
index b5978efac99..5f62c766a01 100644
--- a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql
+++ b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql
@@ -270,3 +270,8 @@ ALTER TABLE llx_product_fournisseur_price ADD COLUMN default_vat_code varchar(10
ALTER TABLE llx_events MODIFY COLUMN ip varchar(250);
+
+
+UPDATE llx_bank SET label= '(SupplierInvoicePayment)' WHERE label= 'Règlement fournisseur';
+UPDATE llx_bank SET label= '(CustomerInvoicePayment)' WHERE label= 'Règlement client';
+
diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php
index b323c970a9d..486b156fcaf 100644
--- a/htdocs/install/step1.php
+++ b/htdocs/install/step1.php
@@ -88,6 +88,7 @@ if (@file_exists($forcedfile)) {
$main_data_dir = detect_dolibarr_main_data_root($main_dir);
}
$main_url = detect_dolibarr_main_url_root();
+
if (!empty($force_install_databaserootlogin)) {
$userroot = parse_database_login($force_install_databaserootlogin);
}
@@ -542,7 +543,7 @@ if (! $error && $db->connected && $action == "set")
if ($db->connected)
{
$resultbis = 1;
-
+
// Create user
$result=$db->DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name);
// Create user bis
@@ -553,7 +554,7 @@ if (! $error && $db->connected && $action == "set")
$resultbis=$db->DDLCreateUser('%', $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name);
}
}
-
+
if ($result > 0 && $resultbis > 0)
{
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index 31a865132c8..833330126bb 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -239,12 +239,43 @@ if (empty($reshook))
else
$object->price_min = GETPOST('price_min');
- $object->tva_tx = str_replace('*','',GETPOST('tva_tx'));
- $object->tva_npr = preg_match('/\*/',GETPOST('tva_tx'))?1:0;
+ $tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' or '8.5*' or '8.5 (XXX)' or '8.5* (XXX)'
- // local taxes.
- $object->localtax1_tx = get_localtax($object->tva_tx,1);
- $object->localtax2_tx = get_localtax($object->tva_tx,2);
+ // We must define tva_tx, npr and local taxes
+ $vatratecode = '';
+ $tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot
+ $npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
+ $localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0';
+ // If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes
+ if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg))
+ {
+ // We look into database using code (we can't use get_localtax() because it depends on buyer that is not known). Same in update price.
+ $vatratecode=$reg[1];
+ // Get record from code
+ $sql = "SELECT t.rowid, t.code, t.recuperableonly, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
+ $sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
+ $sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$mysoc->country_code."'";
+ $sql.= " AND t.taux = ".((float) $tva_tx)." AND t.active = 1";
+ $sql.= " AND t.code ='".$vatratecode."'";
+ $resql=$db->query($sql);
+ if ($resql)
+ {
+ $obj = $db->fetch_object($resql);
+ $npr = $obj->recuperableonly;
+ $localtax1 = $obj->localtax1;
+ $localtax2 = $obj->localtax2;
+ $localtax1_type = $obj->localtax1_type;
+ $localtax2_type = $obj->localtax2_type;
+ }
+ }
+
+ $object->default_vat_code = $vatratecode;
+ $object->tva_tx = $tva_tx;
+ $object->tva_npr = $npr;
+ $object->localtax1_tx = $localtax1;
+ $object->localtax2_tx = $localtax2;
+ $object->localtax1_type = $localtax1_type;
+ $object->localtax2_type = $localtax2_type;
$object->type = $type;
$object->status = GETPOST('statut');
@@ -1109,7 +1140,8 @@ else
// VAT
print '
| '.$langs->trans("VATRate").' | ';
- print $form->load_tva("tva_tx",-1,$mysoc,'');
+ $defaultva=get_default_tva($mysoc, $mysoc);
+ print $form->load_tva("tva_tx", $defaultva, $mysoc, $mysoc, 0, 0, '', false, 1);
print ' |
';
print '';
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 0f28ffdea30..2e2f3007540 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -396,7 +396,7 @@ class Product extends CommonObject
$sql = "SELECT count(*) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."product";
$sql.= " WHERE entity IN (".getEntity('product', 1).")";
- $sql.= " AND ref = '" .$this->ref."'";
+ $sql.= " AND ref = '" .$this->db->escape($this->ref)."'";
$result = $this->db->query($sql);
if ($result)
@@ -1285,7 +1285,7 @@ class Product extends CommonObject
if (empty($this->price_by_qty)) $this->price_by_qty=0;
// Add new price
- $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_price(price_level,date_price,fk_product,fk_user_author,price,price_ttc,price_base_type,tosell, tva_tx, default_vat_code, recuperableonly,";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_price(price_level,date_price, fk_product, fk_user_author, price, price_ttc, price_base_type,tosell, tva_tx, default_vat_code, recuperableonly,";
$sql.= " localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, price_min,price_min_ttc,price_by_qty,entity,fk_price_expression) ";
$sql.= " VALUES(".($level?$level:1).", '".$this->db->idate($now)."',".$this->id.",".$user->id.",".$this->price.",".$this->price_ttc.",'".$this->price_base_type."',".$this->status.",".$this->tva_tx.", ".($this->default_vat_code?("'".$this->default_vat_code."'"):"null").",".$this->tva_npr.",";
$sql.= " ".$this->localtax1_tx.", ".$this->localtax2_tx.", '".$this->localtax1_type."', '".$this->localtax2_type."', ".$this->price_min.",".$this->price_min_ttc.",".$this->price_by_qty.",".$conf->entity.",".($this->fk_price_expression > 0?$this->fk_price_expression:'null');
@@ -1721,6 +1721,7 @@ class Product extends CommonObject
$this->tva_tx = $obj->tva_tx;
//! French VAT NPR
$this->tva_npr = $obj->tva_npr;
+ $this->recuperableonly = $obj->tva_npr; // For backward compatibility
//! Local taxes
$this->localtax1_tx = $obj->localtax1_tx;
$this->localtax2_tx = $obj->localtax2_tx;
diff --git a/htdocs/product/price.php b/htdocs/product/price.php
index cbfe90a5a52..2b5617c601d 100644
--- a/htdocs/product/price.php
+++ b/htdocs/product/price.php
@@ -113,7 +113,7 @@ if (empty($reshook))
// If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes
if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg))
{
- // We look into database using code
+ // We look into database using code (we can't use get_localtax() because it depends on buyer that is not known). Same in create product.
$vatratecode=$reg[1];
// Get record from code
$sql = "SELECT t.rowid, t.code, t.recuperableonly, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
@@ -1819,7 +1819,10 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
print "
" . " | ";
print '
' . $langs->trans($object->price_base_type) . " | ";
- print '
' . vatrate($object->tva_tx, true, $object->recuperableonly) . " | ";
+ print '
';
+ print vatrate($object->tva_tx, true, $object->recuperableonly);
+ print $object->default_vat_code?' ('.$object->default_vat_code.')':'';
+ print " | ";
print '
' . price($object->price) . " | ";
print '
' . price($object->price_ttc) . " | ";
print '
' . price($object->price_min) . ' | ';