From 9eeb80151eefc59acc76f0eb0ce84d38df01104c Mon Sep 17 00:00:00 2001 From: TuxGasy Date: Fri, 9 Mar 2018 21:13:54 +0100 Subject: [PATCH 01/10] Fix bug when updating multi currency rate on invoice supplier --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ab7afea77a4..4d44a4b6fec 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1560,7 +1560,7 @@ abstract class CommonObject $this->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, false, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice); break; case 'invoice_supplier': - $this->updateline($line->id, $line->desc, $line->subprice, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->qty, 0, 'HT', $line->info_bits, $line->product_type, $line->remise_percent, false, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice); + $this->updateline($line->id, $line->desc, $line->subprice, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->qty, $line->fk_product, 'HT', $line->info_bits, $line->product_type, $line->remise_percent, false, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice); break; default: dol_syslog(get_class($this).'::setMulticurrencyRate no updateline defined', LOG_DEBUG); From fd36ade61a1a6e9a68079638a260e00b2cfff204 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 10 Mar 2018 11:20:32 +0100 Subject: [PATCH 02/10] Fix unit in replenish #7225 --- htdocs/product/stock/replenish.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 26c6ab1dfd1..23cb58ed7e3 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -154,6 +154,8 @@ if ($action == 'order' && isset($_POST['valid'])) $line->total_ttc = $line->total_ht + $line->total_tva; $line->remise_percent = $obj->remise_percent; $line->ref_fourn = $obj->ref_fourn; + $line->type = $product->type; + $line->fk_unit = $product->fk_unit; $suppliers[$obj->fk_soc]['lines'][] = $line; } } @@ -198,7 +200,13 @@ if ($action == 'order' && isset($_POST['valid'])) $line->remise_percent, 'HT', 0, - $line->info_bits + $line->type, + 0, + false, + null, + null, + 0, + $line->fk_unit ); } if ($result < 0) { From c00885384232356c0c51475a861c204242255334 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 10 Mar 2018 23:03:41 +0100 Subject: [PATCH 03/10] Fix #8057 --- htdocs/contact/class/contact.class.php | 21 +++++++++++-------- .../mailings/advthirdparties.modules.php | 6 +++--- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 3b7ce848731..21c7527dae2 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -991,9 +991,10 @@ class Contact extends CommonObject * @param string $option Where the link point to * @param int $maxlen Max length of * @param string $moreparam Add more param into URL + * @param int $notooltip 1=Disable tooltip * @return string String with URL */ - function getNomUrl($withpicto=0,$option='',$maxlen=0,$moreparam='') + function getNomUrl($withpicto=0,$option='',$maxlen=0,$moreparam='',$notooltip=0) { global $conf, $langs, $hookmanager; @@ -1012,13 +1013,15 @@ class Contact extends CommonObject $link = 'global->MAIN_OPTIMIZEFORTEXTBROWSER)) - { - $label=$langs->trans("ShowContact"); - $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; - } - $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose.= ' class="classfortooltip">'; + if (empty($notooltip)) { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowContact"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.= ' class="classfortooltip"'; + } if (! is_object($hookmanager)) { @@ -1030,7 +1033,7 @@ class Contact extends CommonObject $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $linkclose = $hookmanager->resPrint; - $link.=$linkclose; + $link.=$linkclose.'>'; $linkend=''; diff --git a/htdocs/core/modules/mailings/advthirdparties.modules.php b/htdocs/core/modules/mailings/advthirdparties.modules.php index 9252ae5ec3a..a747bc3625c 100644 --- a/htdocs/core/modules/mailings/advthirdparties.modules.php +++ b/htdocs/core/modules/mailings/advthirdparties.modules.php @@ -100,7 +100,7 @@ class mailing_advthirdparties extends MailingTargets 'source_url' => $this->url($obj->id,'thirdparty'), 'source_id' => $obj->id, 'source_type' => 'thirdparty' - ); + ); } } @@ -289,11 +289,11 @@ class mailing_advthirdparties extends MailingTargets if ($type=='thirdparty') { $companystatic=new Societe($this->db); $companystatic->fetch($id); - return $companystatic->getNomUrl(0); + return $companystatic->getNomUrl(0,'',0,1); } elseif ($type=='contact') { $contactstatic=new Contact($this->db); $contactstatic->fetch($id); - return $contactstatic->getNomUrl(0); + return $contactstatic->getNomUrl(0,'',0,'',1); } } From c2397fad60d61f5939bf57775c9a3e7e8a95815b Mon Sep 17 00:00:00 2001 From: Inovea Conseil Date: Sat, 10 Mar 2018 23:49:43 +0100 Subject: [PATCH 04/10] Fix #8092 --- htdocs/societe/card.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index d3f629952b1..b5d643abc98 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -10,6 +10,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) 2018 Nicolas ZABOURI * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -295,7 +296,8 @@ if (empty($reshook)) if (! $error) { $result = $object->insertExtraFields(); - if ($result < 0) $error++; + if ($result < 0) $errors = $object->errors; + } if ($error) $action = 'edit_extras'; } From 03f7df88c622708db3d8f95b18317d29f3e4823c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 11 Mar 2018 00:05:32 +0100 Subject: [PATCH 05/10] Update card.php --- htdocs/societe/card.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index b5d643abc98..42abde0e09b 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -292,12 +292,15 @@ if (empty($reshook)) // Fill array 'array_options' with data from update form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); - if ($ret < 0) $error++; + if ($ret < 0) { $error++; } if (! $error) { $result = $object->insertExtraFields(); - if ($result < 0) $errors = $object->errors; - + if ($result < 0) + { + $error++; + $errors = $object->errors; + } } if ($error) $action = 'edit_extras'; } From 897b3f7b7948a3eab94006a6c670ea491da7e30f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 11 Mar 2018 00:31:26 +0100 Subject: [PATCH 06/10] Fix setup --- htdocs/compta/bank/list.php | 4 +- htdocs/core/modules/modAccounting.class.php | 41 ++++++++++++++------- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 817d6dc84e9..537585a63d9 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -89,8 +89,8 @@ $arrayfields=array( 'accountype'=>array('label'=>$langs->trans("Type"), 'checked'=>1), 'b.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1), 'b.number'=>array('label'=>$langs->trans("AccountIdShort"), 'checked'=>1), - 'b.account_number'=>array('label'=>$langs->trans("AccountAccounting"), 'checked'=>$conf->accountancy->enabled), - 'b.fk_accountancy_journal'=>array('label'=>$langs->trans("AccountancyJournal"), 'checked'=>$conf->accountancy->enabled), + 'b.account_number'=>array('label'=>$langs->trans("AccountAccounting"), 'checked'=>$conf->accounting->enabled), + 'b.fk_accountancy_journal'=>array('label'=>$langs->trans("AccountancyJournal"), 'checked'=>$conf->accounting->enabled), 'toreconcile'=>array('label'=>$langs->trans("TransactionsToConciliate"), 'checked'=>1), 'b.currency_code'=>array('label'=>$langs->trans("Currency"), 'checked'=>0), 'b.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 3f8a7c092b8..325c504af42 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -71,73 +71,88 @@ class modAccounting extends DolibarrModules $this->langfiles = array("accountancy","compta"); // Constants + // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) + // Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), + // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) + // ); $this->const = array(); $this->const[1] = array( "MAIN_COMPANY_CODE_ALWAYS_REQUIRED", "chaine", "1", - "With this constants on, third party code is always required whatever is numbering module behaviour" + "With this constants on, third party code is always required whatever is numbering module behaviour", 0, 'current', 0 ); $this->const[2] = array( "MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED", "chaine", "1", - "With this constants on, bank account number is always required" + "With this constants on, bank account number is always required", 0, 'current', 1 ); $this->const[3] = array( "ACCOUNTING_ACCOUNT_SUSPENSE", "chaine", - "471" + "471", + "", 0, 'current', 0 ); $this->const[4] = array( "ACCOUNTING_ACCOUNT_TRANSFER_CASH", "chaine", - "58" + "58", + "", 0, 'current', 0 ); $this->const[5] = array( "CHARTOFACCOUNTS", "chaine", - "2" + "2", + "", 0, 'current', 0 ); $this->const[6] = array( "ACCOUNTING_EXPORT_MODELCSV", "chaine", - "1" + "1", + "", 0, 'current', 0 ); $this->const[7] = array( "ACCOUNTING_LENGTH_GACCOUNT", "chaine", - "" + "", + "", 0, 'current', 0 ); $this->const[8] = array( "ACCOUNTING_LENGTH_AACCOUNT", "chaine", - "" + "", + "", 0, 'current', 0 ); $this->const[9] = array( "ACCOUNTING_LIST_SORT_VENTILATION_TODO", "yesno", - "1" + "1", + "", 0, 'current', 0 ); $this->const[10] = array( "ACCOUNTING_LIST_SORT_VENTILATION_DONE", "yesno", - "1" + "1", + "", 0, 'current', 0 ); $this->const[11] = array ( "ACCOUNTING_EXPORT_DATE", "chaine", - "%d%m%Y" + "%d%m%Y", + "", 0, 'current', 0 ); $this->const[12] = array( "ACCOUNTING_EXPORT_SEPARATORCSV", "string", - "," + ",", + "", 0, 'current', 0 ); $this->const[13] = array( "ACCOUNTING_EXPORT_FORMAT", "chaine", - "csv" + "csv", + "", 0, 'current', 0 ); // Tabs From 5c4b5cc74f38e3346b8a7ad5e34a5a7977da8db7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 11 Mar 2018 00:40:35 +0100 Subject: [PATCH 07/10] fix --- htdocs/compta/bank/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 537585a63d9..6a39416342e 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -89,8 +89,8 @@ $arrayfields=array( 'accountype'=>array('label'=>$langs->trans("Type"), 'checked'=>1), 'b.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1), 'b.number'=>array('label'=>$langs->trans("AccountIdShort"), 'checked'=>1), - 'b.account_number'=>array('label'=>$langs->trans("AccountAccounting"), 'checked'=>$conf->accounting->enabled), - 'b.fk_accountancy_journal'=>array('label'=>$langs->trans("AccountancyJournal"), 'checked'=>$conf->accounting->enabled), + 'b.account_number'=>array('label'=>$langs->trans("AccountAccounting"), 'checked'=>(! empty($conf->accounting->enabled) || ! empty($conf->accounting->enabled))), + 'b.fk_accountancy_journal'=>array('label'=>$langs->trans("AccountancyJournal"), 'checked'=>(! empty($conf->accounting->enabled) || ! empty($conf->accounting->enabled))), 'toreconcile'=>array('label'=>$langs->trans("TransactionsToConciliate"), 'checked'=>1), 'b.currency_code'=>array('label'=>$langs->trans("Currency"), 'checked'=>0), 'b.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), From a3d25b24d31b43c21dc6276af1f45d08ac1e8e55 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 11 Mar 2018 19:27:03 +0100 Subject: [PATCH 08/10] FIX #8285 Extrafields now reported by /api/index.php/agendaevents/{id} --- htdocs/comm/action/class/api_agendaevents.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index 58deec46f5e..7fd76b5d1a9 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -80,6 +80,8 @@ class AgendaEvents extends DolibarrApi throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } + $result = $this->actioncomm->fetch_optionals(); + $this->actioncomm->fetchObjectLinked(); return $this->_cleanObjectDatas($this->actioncomm); } @@ -319,7 +321,6 @@ class AgendaEvents extends DolibarrApi unset($object->usermod); unset($object->libelle); - unset($object->array_options); unset($object->context); unset($object->canvas); unset($object->contact); From e1654f4215b3613940887a51499759e11651aa6c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 11 Mar 2018 21:18:18 +0100 Subject: [PATCH 09/10] Fix division by zero --- htdocs/compta/tva/quadri_detail.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index c622881d273..d4ccbf98804 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -447,7 +447,7 @@ else $ratiopaymentinvoice=1; if ($modetax == 0) { - if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']); + if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']); print ''; //print $fields['totalht']."-".$fields['payment_amount']."-".$fields['ftotal_ttc']; if ($fields['payment_amount'] && $fields['ftotal_ttc']) From 51c94fadfa8f1405f7164af90c1a81cbbaadc66b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 11 Mar 2018 21:31:34 +0100 Subject: [PATCH 10/10] Look and feel v7 --- htdocs/admin/taxes.php | 18 +++++++++++++----- htdocs/langs/en_US/compta.lang | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/taxes.php b/htdocs/admin/taxes.php index a4aa1afbd8c..391f3c38cc7 100644 --- a/htdocs/admin/taxes.php +++ b/htdocs/admin/taxes.php @@ -113,13 +113,14 @@ if ($action == 'update') { */ llxHeader(); + $form=new Form($db); if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db); $linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans('TaxSetup'),$linkback,'title_setup'); -dol_fiche_head(); +dol_fiche_head(null, '0', '', -1); if (empty($mysoc->tva_assuj)) { @@ -127,6 +128,8 @@ if (empty($mysoc->tva_assuj)) } else { + print '
'; + print ''; // Cas des parametres TAX_MODE_SELL/BUY_SERVICE/PRODUCT @@ -146,7 +149,7 @@ else print "
\n"; print '
'; - print load_fiche_titre($langs->trans("SummaryOfVatExigibilityUsedByDefault"),'',''); + print ' -> '.$langs->trans("SummaryOfVatExigibilityUsedByDefault"); //print ' ('.$langs->trans("CanBeChangedWhenMakingInvoice").')'; print ''; @@ -195,22 +198,27 @@ else print "
\n"; + + /* * Others params */ + +print load_fiche_titre($langs->trans("OtherOptions"),'',''); + print '
'; print ''; -print ''; +print ''; print "\n"; foreach ($list as $key) { - + print ''; // Param - $label = $langs->trans($key); + $label = $langs->trans($key); print ''; // Value diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index d1413fb0454..e476c951123 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -31,7 +31,7 @@ Credit=Credit Piece=Accounting Doc. AmountHTVATRealReceived=Net collected AmountHTVATRealPaid=Net paid -VATToPay=VAT sells +VATToPay=Tax sales VATReceived=Tax received VATToCollect=Tax purchases VATSummary=Tax Balance
' . $langs->trans('OtherOptions') . '' . $langs->trans('Parameters') . '