From 10b231bd9d0fde67c75a26762a9bd7cd5e6ed5ef Mon Sep 17 00:00:00 2001 From: abb Date: Sat, 17 Dec 2016 11:02:06 +0100 Subject: [PATCH 01/36] =?UTF-8?q?new:identificateurs=20mprofessionnels=20p?= =?UTF-8?q?our=20l'alg=C3=A9rie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/langs/fr_FR/companies.lang | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang index 2a148eebf37..d994b5b6f34 100644 --- a/htdocs/langs/fr_FR/companies.lang +++ b/htdocs/langs/fr_FR/companies.lang @@ -239,6 +239,11 @@ ProfId3RU=Id. prof.3 (KPP) ProfId4RU=Id. prof.4 (OKPO) ProfId5RU=- ProfId6RU=- +ProfId1DZ=RC +ProfId2DZ=Art. +ProfId3DZ=NIF +ProfId4DZ=NIS + VATIntra=Numéro de TVA VATIntraShort=Num. TVA VATIntraSyntaxIsValid=Syntaxe valide From 08846da2d31fd6e0c22f824008533e87bb863d96 Mon Sep 17 00:00:00 2001 From: abb Date: Sun, 18 Dec 2016 20:05:56 +0100 Subject: [PATCH 02/36] new: Professional identifiers for Algeria --- htdocs/langs/en_US/companies.lang | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 4a631b092cf..553e4d884e8 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -239,6 +239,10 @@ ProfId3RU=Prof Id 3 (KPP) ProfId4RU=Prof Id 4 (OKPO) ProfId5RU=- ProfId6RU=- +ProfId1DZ=RC +ProfId2DZ=Art. +ProfId3DZ=NIF +ProfId4DZ=NIS VATIntra=VAT number VATIntraShort=VAT number VATIntraSyntaxIsValid=Syntax is valid From e1773249c30b7229c32644d42d809d1d84fd1668 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Mon, 19 Dec 2016 05:56:47 +0100 Subject: [PATCH 03/36] Fix: Traduction on index accountancy page & improvements --- htdocs/accountancy/admin/defaultaccounts.php | 7 ++-- htdocs/accountancy/index.php | 37 +++++++++++--------- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php index 6854c8a45ff..1c49b65bac8 100644 --- a/htdocs/accountancy/admin/defaultaccounts.php +++ b/htdocs/accountancy/admin/defaultaccounts.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2014 Marcos García * Copyright (C) 2014 Juanjo Menent @@ -62,7 +62,10 @@ $list_account = array ( 'ACCOUNTING_VAT_PAY_ACCOUNT', 'ACCOUNTING_ACCOUNT_SUSPENSE', 'ACCOUNTING_ACCOUNT_TRANSFER_CASH', - 'DONATION_ACCOUNTINGACCOUNT' + 'DONATION_ACCOUNTINGACCOUNT', + 'LOAN_ACCOUNTING_ACCOUNT_CAPITAL', + 'LOAN_ACCOUNTING_ACCOUNT_INTEREST', + 'LOAN_ACCOUNTING_ACCOUNT_INSURANCE' ); diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 26edab6f859..3a9dde2811b 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -1,5 +1,6 @@ + * Copyright (C) 2016 Alexandre Spangaro * * 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 @@ -36,9 +37,6 @@ $langs->load("accountancy"); if ($user->societe_id > 0) accessforbidden(); -// Validate History -$action = GETPOST('action'); - $langs->load("admin"); $langs->load("dict"); $langs->load("bills"); @@ -73,11 +71,11 @@ print "
\n"; // STEPS $step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Pcg_version").''); +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Pcg_version").''); print "
\n"; print "
\n"; $step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Chartofaccounts").''); +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Chartofaccounts").''); print "
\n"; print "
\n"; @@ -86,16 +84,16 @@ print "
\n"; print "
\n"; $step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescMisc", $step, ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'')."
\n"; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescMisc", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'')."
\n"; print "
\n"; $step++; -$textlink = ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").''; +$textlink = ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").''; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink); print "
\n"; print "
\n"; if (! empty($conf->tax->enabled)) { - $textlink = ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuTaxAccounts").''; + $textlink = ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuTaxAccounts").''; $step++; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink); print "
\n"; @@ -104,7 +102,7 @@ if (! empty($conf->tax->enabled)) /*if (! empty($conf->salaries->enabled)) { $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); // htdocs/admin/salaries.php print "
\n"; print "
\n"; @@ -112,14 +110,14 @@ if (! empty($conf->tax->enabled)) if (! empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several. { $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").''); + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").''); print "
\n"; print "
\n"; } if (! empty($conf->loan->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several. { $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuLoanAccounts").''); + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuSpecialExpenses").'-'.$langs->transnoentitiesnoconv("Loans").' '.$langs->transnoentitiesnoconv("or").' '.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); print "
\n"; print "
\n"; } @@ -127,7 +125,7 @@ if (! empty($conf->loan->enabled)) // TODO Move this in the default account pag if (! empty($conf->don->enabled)) { $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDonationAccounts").''); + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDonationAccounts").''); print "
\n"; print "
\n"; }*/ @@ -138,7 +136,7 @@ print "
\n"; print "
\n"; $step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("ProductsBinding").'')."
\n"; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("ProductsBinding").'')."
\n"; print "
\n"; print "
\n"; @@ -148,14 +146,21 @@ print "
\n"; $step = 0; $step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescCustomer", $step, ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'')."
\n"; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescCustomer", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'')."
\n"; print "
\n"; + $step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSupplier", $step, ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'')."
\n"; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSupplier", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'')."
\n"; print "
\n"; + $step++; -print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", $step, ''.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'')."
\n"; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'')."
\n"; print "
\n"; + +$step++; +print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", $step)."
\n"; +print "
\n"; + $step++; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", $step)."
\n"; print "
\n"; From 23aea440d63f78c421508f785aff697a0bb7a556 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Mon, 19 Dec 2016 06:04:54 +0100 Subject: [PATCH 04/36] Fix: Travis --- htdocs/adherents/class/subscription.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index 547265098be..733524e53c0 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -293,7 +293,6 @@ class Subscription extends CommonObject * Renvoi le libelle d'un statut donne * * @param int $statut Id statut - * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label */ function LibStatut($statut) From 9901aaa9fedd0d145d4dbab88336b7516b52acfb Mon Sep 17 00:00:00 2001 From: aspangaro Date: Mon, 19 Dec 2016 06:34:17 +0100 Subject: [PATCH 05/36] Try to correct travis public underscore problem --- htdocs/core/modules/import/modules_import.php | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/core/modules/import/modules_import.php b/htdocs/core/modules/import/modules_import.php index 20ce6ddc34d..cd70a3456bb 100644 --- a/htdocs/core/modules/import/modules_import.php +++ b/htdocs/core/modules/import/modules_import.php @@ -44,12 +44,12 @@ class ModeleImports public $version_lib; // Version of external lib used by driver // Array of all drivers - public $_driverlabel=array(); - public $_driverdesc=array(); - public $_driverversion=array(); + public $driverlabel=array(); + public $driverdesc=array(); + public $driverversion=array(); - public $_liblabel=array(); - public $_libversion=array(); + public $liblabel=array(); + public $libversion=array(); /** @@ -166,19 +166,19 @@ class ModeleImports // Picto $this->picto[$module->id]=$module->picto; // Driver properties - $this->_driverlabel[$module->id]=$module->getDriverLabel(''); - $this->_driverdesc[$module->id]=$module->getDriverDesc(''); - $this->_driverversion[$module->id]=$module->getDriverVersion(''); + $this->driverlabel[$module->id]=$module->getDriverLabel(''); + $this->driverdesc[$module->id]=$module->getDriverDesc(''); + $this->driverversion[$module->id]=$module->getDriverVersion(''); // If use an external lib - $this->_liblabel[$module->id]=$module->getLibLabel(''); - $this->_libversion[$module->id]=$module->getLibVersion(''); + $this->liblabel[$module->id]=$module->getLibLabel(''); + $this->libversion[$module->id]=$module->getLibVersion(''); $i++; } } } - return array_keys($this->_driverlabel); + return array_keys($this->driverlabel); } @@ -201,7 +201,7 @@ class ModeleImports */ function getDriverLabelForKey($key) { - return $this->_driverlabel[$key]; + return $this->driverlabel[$key]; } /** @@ -212,7 +212,7 @@ class ModeleImports */ function getDriverDescForKey($key) { - return $this->_driverdesc[$key]; + return $this->driverdesc[$key]; } /** @@ -223,7 +223,7 @@ class ModeleImports */ function getDriverVersionForKey($key) { - return $this->_driverversion[$key]; + return $this->driverversion[$key]; } /** @@ -234,7 +234,7 @@ class ModeleImports */ function getLibLabelForKey($key) { - return $this->_liblabel[$key]; + return $this->liblabel[$key]; } /** @@ -245,7 +245,7 @@ class ModeleImports */ function getLibVersionForKey($key) { - return $this->_libversion[$key]; + return $this->libversion[$key]; } } From 0fae7ecd5a471002bd18638002ce392da1dd54ab Mon Sep 17 00:00:00 2001 From: aspangaro Date: Mon, 19 Dec 2016 07:43:33 +0100 Subject: [PATCH 06/36] Fix: Accountancy Expense report index --- htdocs/accountancy/expensereport/index.php | 63 +++++++++++----------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index fea9cff6020..b4c5da80af4 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -68,9 +68,9 @@ if ($action == 'validatehistory') { $db->begin(); // First clean corrupted data - $sqlclean = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd"; - $sqlclean .= " SET fd.fk_code_ventilation = 0"; - $sqlclean .= ' WHERE fd.fk_code_ventilation NOT IN '; + $sqlclean = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd"; + $sqlclean .= " SET erd.fk_code_ventilation = 0"; + $sqlclean .= ' WHERE erd.fk_code_ventilation NOT IN '; $sqlclean .= ' (SELECT accnt.rowid '; $sqlclean .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt'; $sqlclean .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst'; @@ -79,18 +79,18 @@ if ($action == 'validatehistory') { // Now make the binding if ($db->type == 'pgsql') { - $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; + $sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det"; $sql1 .= " SET fk_code_ventilation = accnt.rowid"; - $sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; - $sql1 .= " WHERE " . MAIN_DB_PREFIX . "facture_fourn_det.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS; - $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number"; - $sql1 .= " AND " . MAIN_DB_PREFIX . "facture_fourn_det.fk_code_ventilation = 0"; + $sql1 .= " FROM " . MAIN_DB_PREFIX . "c_type_fees as t, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; + $sql1 .= " WHERE " . MAIN_DB_PREFIX . "expensereport_det.fk_c_type_fees = t.id AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS; + $sql1 .= " AND accnt.active = 1 AND t.accountancy_code = accnt.account_number"; + $sql1 .= " AND " . MAIN_DB_PREFIX . "expensereport_det.fk_code_ventilation = 0"; } else { - $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd, " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; - $sql1 .= " SET fd.fk_code_ventilation = accnt.rowid"; - $sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS; - $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number"; - $sql1 .= " AND fd.fk_code_ventilation = 0"; + $sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd, " . MAIN_DB_PREFIX . "c_type_fees as t, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; + $sql1 .= " SET erd.fk_code_ventilation = accnt.rowid"; + $sql1 .= " WHERE erd.fk_c_type_fees = t.id AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS; + $sql1 .= " AND accnt.active = 1 AND t.accountancy_code=accnt.account_number"; + $sql1 .= " AND erd.fk_code_ventilation = 0"; } $resql1 = $db->query($sql1); @@ -106,9 +106,9 @@ if ($action == 'validatehistory') { $error = 0; $db->begin(); - $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd"; - $sql1 .= " SET fd.fk_code_ventilation = 0"; - $sql1 .= ' WHERE fd.fk_code_ventilation NOT IN '; + $sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd"; + $sql1 .= " SET erd.fk_code_ventilation = 0"; + $sql1 .= ' WHERE erd.fk_code_ventilation NOT IN '; $sql1 .= ' (SELECT accnt.rowid '; $sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt'; $sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst'; @@ -129,12 +129,12 @@ if ($action == 'validatehistory') { $error = 0; $db->begin(); - $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd"; - $sql1.= " SET fd.fk_code_ventilation = 0"; - $sql1.= " WHERE fd.fk_facture_fourn IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture_fourn as f"; - $sql1.= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'"; - $sql1.= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'"; - $sql1.= " AND f.entity IN (" . getEntity("accountancy", 1) . ")"; + $sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd"; + $sql1.= " SET erd.fk_code_ventilation = 0"; + $sql1.= " WHERE erd.fk_expensereport IN ( SELECT er.rowid FROM " . MAIN_DB_PREFIX . "expensereport as er"; + $sql1.= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'"; + $sql1.= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'"; + $sql1.= " AND er.entity IN (" . getEntity("accountancy", 1) . ")"; $sql1.=")"; dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG); @@ -197,16 +197,17 @@ print '' . $langs->trans("Total") . 'ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,"; $sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,"; for($i = 1; $i <= 12; $i ++) { - $sql .= " SUM(" . $db->ifsql('MONTH(er.date_create)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ","; + $sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ","; } $sql .= " ROUND(SUM(erd.total_ht),2) as total"; $sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation"; -$sql .= " WHERE er.date_create >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'"; -$sql .= " AND er.date_create <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'"; +$sql .= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'"; +$sql .= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'"; $sql .= " AND er.fk_statut > 0 "; $sql .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")"; // We don't share object for accountancy +$sql .= " AND aa.account_number IS NULL"; $sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label"; dol_syslog('/accountancy/expensereport/index.php:: sql=' . $sql); @@ -250,17 +251,17 @@ print '' . $langs->trans("Total") . 'ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,"; $sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,"; for($i = 1; $i <= 12; $i ++) { - $sql .= " SUM(" . $db->ifsql('MONTH(er.date_create)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ","; + $sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ","; } $sql .= " ROUND(SUM(erd.total_ht),2) as total"; $sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation"; -$sql .= " WHERE er.date_create >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'"; -$sql .= " AND er.date_create <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'"; +$sql .= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'"; +$sql .= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'"; $sql .= " AND er.fk_statut > 0 "; $sql .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")"; // We don't share object for accountancy -$sql .= " AND aa.account_number IS NULL"; +$sql .= " AND aa.account_number IS NOT NULL"; $sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label"; dol_syslog('/accountancy/expensereport/index.php:: sql=' . $sql); @@ -312,8 +313,8 @@ for($i = 1; $i <= 12; $i ++) { $sql .= " ROUND(SUM(erd.total_ht),2) as total"; $sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport"; -$sql .= " WHERE er.date_create >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'"; -$sql .= " AND er.date_create <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'"; +$sql .= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'"; +$sql .= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'"; $sql .= " AND er.fk_statut > 0 "; $sql .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")"; // We don't share object for accountancy From 098dc08169d1efdd669aebc464d31555fe67c725 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 20 Dec 2016 07:29:49 +0100 Subject: [PATCH 07/36] Loan : Complete work on dol_banner --- htdocs/core/lib/functions.lib.php | 9 +- htdocs/loan/card.php | 153 +++++++++++++++++++----------- htdocs/loan/class/loan.class.php | 10 +- htdocs/loan/document.php | 84 +++++----------- htdocs/loan/info.php | 45 +++++---- htdocs/loan/note.php | 34 ++++--- 6 files changed, 182 insertions(+), 153 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9b37c9c29e3..98dc7f14fd4 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1071,6 +1071,12 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5, $object->totalpaye); $morehtmlstatus.=$tmptxt; } + elseif ($object->element == 'loan') + { + $tmptxt=$object->getLibStatut(6, $object->totalpaye); + if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5, $object->totalpaye); + $morehtmlstatus.=$tmptxt; + } elseif ($object->element == 'contrat') { if ($object->statut==0) $morehtmlstatus.=$object->getLibStatut(2); @@ -1082,7 +1088,8 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r $morehtmlstatus.=$tmptxt; } if (! empty($object->name_alias)) $morehtmlref.='
'.$object->name_alias.'
'; // For thirdparty - if (! empty($object->label)) $morehtmlref.='
'.$object->label.'
'; // For product + if ($object->element == 'product' && ! empty($object->label)) $morehtmlref.='
'.$object->label.'
'; + if ($object->element != 'product') { $morehtmlref.='
'; diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index be04b806b1f..6dd6b17ccff 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2014-2016 Alexandre Spangaro * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify @@ -86,8 +86,9 @@ if ($action == 'add' && $user->rights->loan->write) { if (! $cancel) { - $datestart=@dol_mktime(12,0,0, $_POST["startmonth"], $_POST["startday"], $_POST["startyear"]); - $dateend=@dol_mktime(12,0,0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]); + $datestart = dol_mktime(12, 0, 0, GETPOST('startmonth','int'), GETPOST('startday','int'), GETPOST('startyear','int')); + $dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int')); + $capital = price2num(GETPOST('capital')); if (! $datestart) { @@ -99,20 +100,20 @@ if ($action == 'add' && $user->rights->loan->write) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateEnd")), null, 'errors'); $action = 'create'; } - elseif (! $_POST["capital"]) + elseif (! $capital) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors'); $action = 'create'; } else { - $object->label = $_POST["label"]; - $object->fk_bank = $_POST["accountid"]; - $object->capital = $_POST["capital"]; + $object->label = GETPOST('label'); + $object->fk_bank = GETPOST('accountid'); + $object->capital = $capital; $object->datestart = $datestart; $object->dateend = $dateend; - $object->nbterm = $_POST["nbterm"]; - $object->rate = $_POST["rate"]; + $object->nbterm = GETPOST('nbterm'); + $object->rate = GETPOST('rate'); $object->note_private = GETPOST('note_private'); $object->note_public = GETPOST('note_public'); @@ -147,9 +148,9 @@ else if ($action == 'update' && $user->rights->loan->write) if ($object->fetch($id)) { - $object->label = GETPOST("label"); $object->datestart = dol_mktime(12, 0, 0, GETPOST('startmonth','int'), GETPOST('startday','int'), GETPOST('startyear','int')); $object->dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int')); + $object->capital = price2num(GETPOST("capital")); $object->nbterm = GETPOST("nbterm"); $object->rate = GETPOST("rate"); } @@ -173,6 +174,14 @@ else if ($action == 'update' && $user->rights->loan->write) } } +if ($action == 'setlabel' && $user->rights->loan->write) +{ + $object->fetch($id); + $result = $object->setValueFrom('label', GETPOST('label'), '', '', 'text', '', $user, 'LOAN_MODIFY'); + if ($result < 0) + setEventMessages($object->error, $object->errors, 'errors'); +} + /* * View */ @@ -180,8 +189,9 @@ else if ($action == 'update' && $user->rights->loan->write) $form = new Form($db); if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db); -$help_url='EN:Module_Loan|FR:Module_Emprunt'; -llxHeader("",$langs->trans("Loan"),$help_url); +$title = $langs->trans("Loan") . ' - ' . $langs->trans("Card"); +$help_url = 'EN:Module_Loan|FR:Module_Emprunt'; +llxHeader("",$title,$help_url); // Create mode @@ -203,7 +213,7 @@ if ($action == 'create') print ''; // Label - print ''; + print ''; // Bank account if (! empty($conf->banque->enabled)) @@ -243,7 +253,7 @@ if ($action == 'create') // Note Private print ''; print ''; - print ''; print ''; - print ''; - print '
'.$langs->trans("Label").'
'.$langs->trans("Label").'
'.$langs->trans('NotePrivate').''; + print ''; $doleditor = new DolEditor('note_private', GETPOST('note_private', 'alpha'), '', 160, 'dolibarr_notes', 'In', false, true, true, ROWS_6, '90%'); print $doleditor->Create(1); @@ -253,16 +263,11 @@ if ($action == 'create') // Note Public print '
'.$langs->trans('NotePublic').''; + print ''; $doleditor = new DolEditor('note_public', GETPOST('note_public', 'alpha'), '', 160, 'dolibarr_notes', 'In', false, true, true, ROWS_6, '90%'); print $doleditor->Create(1); print '
'; - - print '
'; - - print ''; // Accountancy if (! empty($conf->accounting->enabled)) { @@ -283,7 +288,7 @@ if ($action == 'create') print ''; - } + } else // For external software { // Accountancy_account_capital @@ -300,15 +305,16 @@ if ($action == 'create') print ''; print ''; - - print '
'; print $formaccountancy->select_account($object->accountancy_account_interest, 'accountancy_account_interest', 1, '', 0, 1); print '
'.$langs->trans("LoanAccountancyInterestCode").''; print '
'; } print ''; - + dol_fiche_end(); - print '
     '; - print '
'; + print '
'; + print ''; + print '     '; + print ''; + print '
'; print ''; } @@ -316,12 +322,15 @@ if ($action == 'create') // View if ($id > 0) { + $object = new Loan($db); $result = $object->fetch($id); if ($result > 0) { $head=loan_prepare_head($object); + $totalpaid = $object->getSumPayment(); + // Confirm for loan if ($action == 'paid') { @@ -345,27 +354,54 @@ if ($id > 0) dol_fiche_head($head, 'card', $langs->trans("Loan"), 0, 'bill'); + $morehtmlref='
'; + // Ref loan + $morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', null, null, '', 1); + $morehtmlref.='
'; + + $linkback = '' . $langs->trans("BackToList") . ''; + + $object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + + print '
'; + print '
'; + print '
'; + print ''; + /* // Ref - print '"; // Label if ($action == 'edit') { - print ''; } else { - print ''; + print ''; } + */ // Capital - print ''; + if ($action == 'edit') + { + print ''; + print ''; + } + else + { + print ''; + } // Date start print ""; @@ -433,25 +469,13 @@ if ($id > 0) print ''; // Status - print ''; + // print ''; print '
'.$langs->trans("Ref").''; + print '
'.$langs->trans("Ref").''; print $form->showrefnav($object,'id'); print "
'.$langs->trans("Label").''; + print '
'.$langs->trans("Label").''; print ''; print '
'.$langs->trans("Label").''.$object->label.'
'.$langs->trans("Label").''.$object->label.'
'.$langs->trans("LoanCapital").''.price($object->capital,0,$outputlangs,1,-1,-1,$conf->currency).'
'.$langs->trans("LoanCapital").''; + print '
'.$langs->trans("LoanCapital").''.price($object->capital,0,$outputlangs,1,-1,-1,$conf->currency).'
".$langs->trans("DateStart")."
'.$langs->trans("Status").''.$object->getLibStatut(4, $totalpaye).'
'.$langs->trans("Status").''.$object->getLibStatut(4, $totalpaye).'
'; - dol_fiche_end(); - - - if ($action == 'edit') - { - print '
'; - print ''; - print '   '; - print ''; - print '
'; - print '

'; - } - - print ''; - print '"; - print "
'; + print ''; + print '
'; + print '
'; /* * Payments @@ -477,14 +501,14 @@ if ($id > 0) $total_insurance = 0; $total_interest = 0; $total_capital = 0; - echo ''; + print '
'; print ''; print ''; print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; $var=True; @@ -508,13 +532,13 @@ if ($id > 0) if ($object->paid == 0) { - print ''; - print ''; + print ''; + print ''; $staytopay = $object->capital - $totalpaid; print ''; - print ''; + print ''; } print "
'.$langs->trans("RefPayment").''.$langs->trans("Date").''.$langs->trans("Type").''.$langs->trans("Insurance").''.$langs->trans("Interest").''.$langs->trans("LoanCapital").''.$langs->trans("Insurance").''.$langs->trans("Interest").''.$langs->trans("LoanCapital").'
'.$langs->trans("AlreadyPaid").' :'.price($totalpaid, 0, $langs, 0, 0, -1, $conf->currency).'
'.$langs->trans("AmountExpected").' :'.price($object->capital, 0, $langs, 0, 0, -1, $conf->currency).'
'.$langs->trans("AlreadyPaid").' :'.price($totalpaid, 0, $langs, 0, 0, -1, $conf->currency).'
'.$langs->trans("AmountExpected").' :'.price($object->capital,0,$outputlangs,1,-1,-1,$conf->currency).'
'.$langs->trans("RemainderToPay").' :'.price($staytopay, 0, $langs, 0, 0, -1, $conf->currency).'
'.price($staytopay, 0, $langs, 0, 0, -1, $conf->currency).'
"; $db->free($resql); @@ -523,8 +547,25 @@ if ($id > 0) { dol_print_error($db); } - print "
"; + + print '
'; + print '
'; + print '
'; + + print '
'; + + dol_fiche_end(); + + if ($action == 'edit') + { + print '
'; + print ''; + print '     '; + print ''; + print '
'; + } + + if ($action == 'edit') print "\n"; /* * Buttons actions @@ -562,7 +603,7 @@ if ($id > 0) } else { - // Loan not find + // Loan not found dol_print_error('',$object->error); } } diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index 3c89f8b36b0..97d90cb31e7 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2014-2016 Alexandre Spangaro * Copyright (C) 2015 Frederic France * * This program is free software; you can redistribute it and/or modify @@ -32,6 +32,7 @@ class Loan extends CommonObject public $element='loan'; public $table='loan'; public $table_element='loan'; + public $picto = 'bill'; public $rowid; public $datestart; @@ -278,6 +279,7 @@ class Loan extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."loan"; $sql.= " SET label='".$this->db->escape($this->label)."',"; + $sql.= " capital='".price2num($this->db->escape($this->capital))."',"; $sql.= " datestart='".$this->db->idate($this->datestart)."',"; $sql.= " dateend='".$this->db->idate($this->dateend)."',"; $sql.= " fk_user_modif = ".$user->id; @@ -378,6 +380,12 @@ class Loan extends CommonObject if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); } + if ($mode == 6) + { + if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); + if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); + if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); + } return "Error, mode/status not found"; } diff --git a/htdocs/loan/document.php b/htdocs/loan/document.php index 732d8193638..9a245f17762 100644 --- a/htdocs/loan/document.php +++ b/htdocs/loan/document.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2014-2016 Alexandre Spangaro * * 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 @@ -75,17 +75,33 @@ include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; $form = new Form($db); -$help_url='EN:Module_Loan|FR:Module_Emprunt'; -llxHeader("",$langs->trans("Loan"),$help_url); +$title = $langs->trans("Loan") . ' - ' . $langs->trans("Documents"); +$help_url = 'EN:Module_Loan|FR:Module_Emprunt'; +llxHeader("",$title,$help_url); if ($object->id) { - $alreadypayed=$object->getSumPayment(); + $totalpaid=$object->getSumPayment(); $head = loan_prepare_head($object); dol_fiche_head($head, 'documents', $langs->trans("Loan"), 0, 'bill'); + $morehtmlref='
'; + // Ref loan + $morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', null, null, '', 1); + $morehtmlref.='
'; + + $linkback = '' . $langs->trans("BackToList") . ''; + + $object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + + print '
'; + print '
'; + // Construit liste des fichiers $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); @@ -97,63 +113,13 @@ if ($object->id) print ''; - - // Ref - print '"; - - // Label - if ($action == 'edit') - { - print ''; - } - else - { - print ''; - } - - // Amount - print ''; - - // Date start - print ""; - print ""; - print ""; - - // Date end - print ""; - print ""; - print ""; - - // Status - print ''; - - print ''; + print ''; print ''; - print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object,'id'); - print "
'.$langs->trans("Label").''; - print ''; - print '
'.$langs->trans("Label").''.$object->label.'
'.$langs->trans("LoanCapital").''.price($object->capital,0,$outputlangs,1,-1,-1,$conf->currency).'
".$langs->trans("DateStart").""; - if ($action == 'edit') - { - print $form->select_date($object->datestart, 'start', 0, 0, 0, 'loan', 1, 0, 1); - } - else - { - print dol_print_date($object->datestart,"day"); - } - print "
".$langs->trans("DateEnd").""; - if ($action == 'edit') - { - print $form->select_date($object->dateend, 'end', 0, 0, 0, 'loan', 1, 0, 1); - } - else - { - print dol_print_date($object->dateend,"day"); - } - print "
'.$langs->trans("Status").''.$object->getLibStatut(4,$alreadypayed).'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; + print "\n"; - print '
'; + print "\n"; + + dol_fiche_end(); $modulepart = 'loan'; $permission = $user->rights->loan->write; diff --git a/htdocs/loan/info.php b/htdocs/loan/info.php index 83fab095d17..55f2c2257bb 100644 --- a/htdocs/loan/info.php +++ b/htdocs/loan/info.php @@ -43,29 +43,38 @@ $result = restrictedArea($user, 'loan', $id, '',''); * View */ -$help_url='EN:Module_Loan|FR:Module_Emprunt'; -llxHeader("",$langs->trans("Loan"),$help_url); +$title = $langs->trans("Loan") . ' - ' . $langs->trans("Info"); +$help_url = 'EN:Module_Loan|FR:Module_Emprunt'; +llxHeader("",$title,$help_url); -if ($id > 0) { - $loan = new Loan($db); - $loan->fetch($id); - $loan->info($id); +$object = new Loan($db); +$object->fetch($id); +$object->info($id); - $head = loan_prepare_head($loan); +$head = loan_prepare_head($object); - dol_fiche_head($head, 'info', $langs->trans("Loan"), 0, 'bill'); +dol_fiche_head($head, 'info', $langs->trans("Loan"), 0, 'bill'); - print '
'; - dol_print_object_info($loan); - print '
'; +$morehtmlref='
'; +// Ref loan +$morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', 0, 1); +$morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', null, null, '', 1); +$morehtmlref.='
'; - print ''; -} -else -{ - // $id ? -} +$linkback = '' . $langs->trans("BackToList") . ''; + +$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status + +dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + +print '
'; +print '
'; + +print '
'; +dol_print_object_info($object); +print '
'; + +print '
'; llxFooter(); - $db->close(); diff --git a/htdocs/loan/note.php b/htdocs/loan/note.php index 155dacf460b..b03880a832e 100644 --- a/htdocs/loan/note.php +++ b/htdocs/loan/note.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Florian Henry * Copyright (C) 2015 Frederic France + * Copyright (C) 2016 Alexandre Spangaro * * 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 @@ -21,8 +22,8 @@ /** * \file htdocs/loan/note.php - * \brief Tab for notes on loan * \ingroup loan + * \brief Tab for notes on loan */ require '../main.inc.php'; @@ -56,43 +57,40 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, $form = new Form($db); -llxHeader('',$langs->trans("Loan"),''); +$title = $langs->trans("Loan") . ' - ' . $langs->trans("Notes"); +$help_url = 'EN:Module_Loan|FR:Module_Emprunt'; +llxHeader("",$title,$help_url); if ($id > 0) { /* * Affichage onglets */ + $totalpaid=$object->getSumPayment(); $head = loan_prepare_head($object); dol_fiche_head($head, 'note', $langs->trans("Loan"), 0, 'bill'); + $morehtmlref='
'; + // Ref loan + $morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', null, null, '', 1); + $morehtmlref.='
'; - print '
'; - print ''; + $linkback = '' . $langs->trans("BackToList") . ''; - print ''; + $object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status - // Ref - print ''; - print ''; - // Name - print ''; - print ''; + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); - print "
'.$langs->trans('Ref').''; - print $form->showrefnav($object,'id','',1,'rowid','ref'); - print '
'.$langs->trans("Name").''.$object->label.'
"; + print '
'; + print '
'; - print '
'; - - //$colwidth='25'; $cssclass='titlefield'; $permission = $user->rights->loan->write; // Used by the include of notes.tpl.php include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; - dol_fiche_end(); } From e9765c5190b51c46e2964c43fea819ba024d3bf7 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 20 Dec 2016 07:33:03 +0100 Subject: [PATCH 08/36] Remove colspan --- htdocs/loan/document.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/loan/document.php b/htdocs/loan/document.php index 9a245f17762..575be293de0 100644 --- a/htdocs/loan/document.php +++ b/htdocs/loan/document.php @@ -113,8 +113,8 @@ if ($object->id) print ''; - print ''; - print ''; + print ''; + print ''; print "
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
\n"; print "
\n"; From 499eedffa175e7c9b41298af1809f9d968ef7745 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Tue, 20 Dec 2016 15:17:17 +0100 Subject: [PATCH 09/36] $soc not needed (thirpartie --- htdocs/expedition/note.php | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/htdocs/expedition/note.php b/htdocs/expedition/note.php index 031ba85322e..0f7093fa90c 100644 --- a/htdocs/expedition/note.php +++ b/htdocs/expedition/note.php @@ -97,22 +97,19 @@ $form = new Form($db); if ($id > 0 || ! empty($ref)) { - $soc = new Societe($db); - $soc->fetch($object->socid); - $head=shipping_prepare_head($object); - dol_fiche_head($head, 'note', $langs->trans("Shipment"), 0, 'sending'); + dol_fiche_head($head, 'note', $langs->trans("Shipment"), 0, 'sending'); - // Shipment card - $linkback = ''.$langs->trans("BackToList").''; - - $morehtmlref='
'; - // Ref customer shipment - $morehtmlref.=$form->editfieldkey("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', null, null, '', 1); - // Thirdparty - $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Shipment card + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + // Ref customer shipment + $morehtmlref.=$form->editfieldkey("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project if (! empty($conf->projet->enabled)) { $langs->load("projects"); From 590fcf83995e6ab97fd565d745573e06359e9985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Tue, 20 Dec 2016 18:30:28 +0100 Subject: [PATCH 10/36] NEW: Export max payment date with supplier invoices --- htdocs/core/modules/modFournisseur.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index 2999bddd1bd..017ffd1d121 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -287,12 +287,12 @@ class modFournisseur extends DolibarrModules $this->export_label[$r]='Factures fournisseurs et lignes de facture'; $this->export_icon[$r]='bill'; $this->export_permission[$r]=array(array("fournisseur","facture","export")); - $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.ref_supplier'=>"RefSupplier",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.total_tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_public'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId', + $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.ref_supplier'=>"RefSupplier",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>'DateMaxPayment','f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.total_tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_public'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId', 'p.ref'=>'ProductRef','p.label'=>'ProductLabel','p.accountancy_code_buy'=>'ProductAccountancyBuyCode','project.rowid'=>'ProjectId','project.ref'=>'ProjectRef','project.title'=>'ProjectLabel'); //$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:CompanyName",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Numeric",'f.total_ttc'=>"Numeric",'f.total_tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.tva'=>"Numeric",'fd.product_type'=>'Numeric','fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text'); - $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Numeric",'f.total_ttc'=>"Numeric",'f.total_tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.tva'=>"Numeric",'fd.product_type'=>'Numeric','fd.fk_product'=>'List:product:label', + $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>'Date','f.total_ht'=>"Numeric",'f.total_ttc'=>"Numeric",'f.total_tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.tva'=>"Numeric",'fd.product_type'=>'Numeric','fd.fk_product'=>'List:product:label', 'p.ref'=>'Text','p.label'=>'Text','project.ref'=>'Text','project.title'=>'Text'); - $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.ref_supplier'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.remise_percent'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product', + $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.ref_supplier'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>'invoice','f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.remise_percent'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product', 'p.ref'=>'product','p.label'=>'product','p.accountancy_code_buy'=>'product','project.rowid'=>'project','project.ref'=>'project','project.title'=>'project'); $this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them // Add extra fields object From 3542364da86ee8bd0c81cddef02ec4b9a3ed377f Mon Sep 17 00:00:00 2001 From: Gustavo Novaro Date: Tue, 20 Dec 2016 17:11:50 -0300 Subject: [PATCH 11/36] var to public Improve code style to current php practices --- htdocs/user/class/user.class.php | 113 +++++++++++++++---------------- 1 file changed, 56 insertions(+), 57 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index d917b53078a..5f44e675ece 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -33,7 +33,6 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; - /** * Class to manage Dolibarr users */ @@ -43,90 +42,90 @@ class User extends CommonObject public $table_element='user'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - var $id=0; - var $ldap_sid; - var $search_sid; - var $employee; - var $gender; - var $email; - var $skype; - var $job; - var $signature; - var $address; - var $zip; - var $town; - var $state_id; - var $state_code; - var $state; - var $office_phone; - var $office_fax; - var $user_mobile; - var $admin; - var $login; - var $api_key; - var $entity; + public $id=0; + public $ldap_sid; + public $search_sid; + public $employee; + public $gender; + public $email; + public $skype; + public $job; + public $signature; + public $address; + public $zip; + public $town; + public $state_id; + public $state_code; + public $state; + public $office_phone; + public $office_fax; + public $user_mobile; + public $admin; + public $login; + public $api_key; + public $entity; //! Clear password in memory - var $pass; + public $pass; //! Clear password in database (defined if DATABASE_PWD_ENCRYPTED=0) - var $pass_indatabase; + public $pass_indatabase; //! Encrypted password in database (always defined) - var $pass_indatabase_crypted; + public $pass_indatabase_crypted; - var $datec; - var $datem; + public $datec; + public $datem; //! If this is defined, it is an external user /** * @deprecated * @see socid */ - var $societe_id; + public $societe_id; /** * @deprecated * @see contactid */ - var $contact_id; - var $socid; - var $contactid; + public $contact_id; + public $socid; + public $contactid; - var $fk_member; - var $fk_user; + public $fk_member; + public $fk_user; - var $clicktodial_url; - var $clicktodial_login; - var $clicktodial_password; - var $clicktodial_poste; + public $clicktodial_url; + public $clicktodial_login; + public $clicktodial_password; + public $clicktodial_poste; - var $datelastlogin; - var $datepreviouslogin; - var $statut; - var $photo; - var $lang; + public $datelastlogin; + public $datepreviouslogin; + public $statut; + public $photo; + public $lang; - var $rights; // Array of permissions user->rights->permx - var $all_permissions_are_loaded; /**< \private all_permissions_are_loaded */ + public $rights; // Array of permissions user->rights->permx + public $all_permissions_are_loaded; /**< \private all_permissions_are_loaded */ private $_tab_loaded=array(); // Array of cache of already loaded permissions - var $nb_rights; // Number of rights granted to the user + public $nb_rights; // Number of rights granted to the user - var $conf; // To store personal config + public $conf; // To store personal config var $oldcopy; // To contains a clone of this when we need to save old properties of object - var $users; // To store all tree of users hierarchy - var $parentof; // To store an array of all parents for all ids. + public $users; // To store all tree of users hierarchy + public $parentof; // To store an array of all parents for all ids. - var $accountancy_code; // Accountancy code in prevision of the complete accountancy module + public $accountancy_code; // Accountancy code in prevision of the complete accountancy module - var $thm; // Average cost of employee - Used for valuation of time spent - var $tjm; // Average cost of employee + public $thm; // Average cost of employee - Used for valuation of time spent + public $tjm; // Average cost of employee - var $salary; // Monthly salary - Denormalized value from llx_user_employment - var $salaryextra; // Monthly salary extra - Denormalized value from llx_user_employment - var $weeklyhours; // Weekly hours - Denormalized value from llx_user_employment + public $salary; // Monthly salary - Denormalized value from llx_user_employment + public $salaryextra; // Monthly salary extra - Denormalized value from llx_user_employment + public $weeklyhours; // Weekly hours - Denormalized value from llx_user_employment - var $color; // Define background color for user in agenda + public $color; // Define background color for user in agenda - var $dateemployment; // Define date of employment by company + public $dateemployment; // Define date of employment by company /** * Constructor de la classe From eb2d85ab7812ccfcdcf12380b6556c47f9e3ca92 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 20 Dec 2016 21:39:42 +0100 Subject: [PATCH 12/36] Donation : Complete work on dol_banner & Fix project selector --- htdocs/don/card.php | 15 ++++-- htdocs/don/class/don.class.php | 4 +- htdocs/don/document.php | 10 +++- htdocs/don/info.php | 98 ++++++++++++++++++++++++++++------ htdocs/don/note.php | 80 ++++++++++++++++++++------- 5 files changed, 162 insertions(+), 45 deletions(-) diff --git a/htdocs/don/card.php b/htdocs/don/card.php index fd68b028254..0ace5c88e76 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -49,7 +49,7 @@ $action=GETPOST('action','alpha'); $cancel=GETPOST('cancel'); $amount=GETPOST('amount'); $donation_date=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); -$projectid=GETPOST('projectid')?GETPOST('projectid','int'):GETPOST("fk_projet",'int'); +$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); $object = new Don($db); $extrafields = new ExtraFields($db); @@ -109,7 +109,7 @@ if ($action == 'update') $object->email = GETPOST("email"); $object->date = $donation_date; $object->public = GETPOST("public"); - $object->fk_projet = GETPOST("fk_projet"); + $object->fk_project = GETPOST("fk_project"); $object->note_private= GETPOST("note_private"); $object->note_public = GETPOST("note_public"); @@ -164,7 +164,7 @@ if ($action == 'add') $object->note_private= GETPOST("note_private"); $object->note_public = GETPOST("note_public"); $object->public = GETPOST("public"); - $object->fk_projet = GETPOST("fk_projet"); + $object->fk_project = GETPOST("fk_project"); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); @@ -230,6 +230,11 @@ if ($action == 'set_paid') setEventMessages($object->error, $object->errors, 'errors'); } } +else if ($action == 'classin' && $user->rights->don->creer) +{ + $object->fetch($id); + $object->setProject($projectid); +} // Remove file in doc form if ($action == 'remove_file') { @@ -361,7 +366,7 @@ if ($action == 'create') if (! empty($conf->projet->enabled)) { print "".$langs->trans("Project").""; - $formproject->select_projects(-1, $projectid,'fk_projet', 0, 0, 1, 1); + $formproject->select_projects(-1, $projectid,'fk_project', 0, 0, 1, 1); print "\n"; } @@ -486,7 +491,7 @@ if (! empty($id) && $action == 'edit') $langs->load('projects'); print ''.$langs->trans('Project').''; - $formproject->select_projects(-1, $object->fk_projet,'fk_projet', 0, 0, 1, 1); + $formproject->select_projects(-1, $object->fk_project,'fk_project', 0, 0, 1, 1); print ''; } diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 820c2f9d1b4..d7e4d84baab 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -363,7 +363,7 @@ class Don extends CommonObject $sql.= ", '".$this->db->escape($this->town)."'"; $sql.= ", ".$this->country_id; $sql.= ", ".$this->public; - $sql.= ", ".($this->fk_projet > 0?$this->fk_projet:"null"); + $sql.= ", ".($this->fk_project > 0?$this->fk_project:"null"); $sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL"); $sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL"); $sql.= ", ".$user->id; @@ -459,7 +459,7 @@ class Don extends CommonObject $sql .= ",town='".$this->db->escape($this->town)."'"; $sql .= ",fk_country = ".$this->country_id; $sql .= ",public=".$this->public; - $sql .= ",fk_projet=".($this->fk_projet>0?$this->fk_projet:'null'); + $sql .= ",fk_projet=".($this->fk_project>0?$this->fk_project:'null'); $sql .= ",note_private=".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL"); $sql .= ",note_public=".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL"); $sql .= ",datedon='".$this->db->idate($this->date)."'"; diff --git a/htdocs/don/document.php b/htdocs/don/document.php index ff25ca2828d..9a253bf57be 100644 --- a/htdocs/don/document.php +++ b/htdocs/don/document.php @@ -48,6 +48,7 @@ $id = GETPOST('id','int'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action','alpha'); $confirm = GETPOST('confirm','alpha'); +$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); // Security check if ($user->societe_id) $socid=$user->societe_id; @@ -79,6 +80,11 @@ $modulepart='don'; include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; +if ($action == 'classin' && $user->rights->don->creer) +{ + $object->fetch($id); + $object->setProject($projectid); +} /* * View @@ -87,7 +93,9 @@ include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; $form = new Form($db); if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } -llxHeader("",$langs->trans("Donation")); +$title = $langs->trans('Donation') . " - " . $langs->trans('Documents'); +$helpurl = ""; +llxHeader('', $title, $helpurl); if ($object->id) diff --git a/htdocs/don/info.php b/htdocs/don/info.php index 6e7bce98b4c..96310e010f5 100644 --- a/htdocs/don/info.php +++ b/htdocs/don/info.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2015-2016 Alexandre Spangaro * * 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 @@ -25,37 +25,101 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; +if (! empty($conf->projet->enabled)) +{ + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +} $langs->load("donations"); -// Security check $id = GETPOST('id','int'); +$ref=GETPOST('ref','alpha'); +$action=GETPOST('action','alpha'); +$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); + +// Security check if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'don', $id, ''); +$object = new Don($db); +$object->fetch($id); +/* + * Actions + */ +if ($action == 'classin' && $user->rights->don->creer) +{ + $object->fetch($id); + $object->setProject($projectid); +} /* * View */ +$title = $langs->trans('Donation') . " - " . $langs->trans('Info'); +$helpurl = ""; +llxHeader('', $title, $helpurl); -llxHeader("",$langs->trans("Donation")); +$form = new Form($db); +if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } -if ($id) +$object->info($id); + +$head = donation_prepare_head($object); + +dol_fiche_head($head, 'info', $langs->trans("Donation"), 0, 'generic'); + +$linkback = ''.$langs->trans("BackToList").''; + +$morehtmlref='
'; +// Project +if (! empty($conf->projet->enabled)) { - $object = new Don($db); - $object->fetch($id); - $object->info($id); - - $head = donation_prepare_head($object); - - dol_fiche_head($head, 'info', $langs->trans("Donation"), 0, 'generic'); - - print '
'; - dol_print_object_info($object); - print '
'; - - print '
'; + $langs->load("projects"); + $morehtmlref.=$langs->trans('Project') . ' '; + if ($user->rights->don->creer) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } } +$morehtmlref.='
'; + +dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref); + +print '
'; +print '
'; + +print '
'; + +print '
'; +dol_print_object_info($object); +print '
'; + +print '
'; + +dol_fiche_end(); llxFooter(); $db->close(); diff --git a/htdocs/don/note.php b/htdocs/don/note.php index 22d02fddb01..1ed3e1a2f1d 100644 --- a/htdocs/don/note.php +++ b/htdocs/don/note.php @@ -2,7 +2,8 @@ /* Copyright (C) 2004 Rodolphe Quiedeville * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2016 Alexandre Spangaro * * 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 @@ -19,15 +20,20 @@ */ /** - * \file htdocs/compta/facture/note.php - * \ingroup facture - * \brief Fiche de notes sur une facture + * \file htdocs/don/note.php + * \ingroup donations + * \brief Page to show a donation notes */ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +if (! empty($conf->projet->enabled)) +{ + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +} $langs->load("companies"); $langs->load("bills"); @@ -36,6 +42,7 @@ $langs->load("donations"); $id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility $ref=GETPOST('ref','alpha'); $action=GETPOST('action','alpha'); +$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); // Security check $socid=0; @@ -51,10 +58,13 @@ $permissionnote=$user->rights->don->creer; // Used by the include of actions_set /* * Actions */ +include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once - - +if ($action == 'classin' && $user->rights->don->creer) +{ + $object->fetch($id); + $object->setProject($projectid); +} /* * View @@ -65,35 +75,65 @@ $helpurl = ""; llxHeader('', $title, $helpurl); $form = new Form($db); +if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } if ($id > 0 || ! empty($ref)) { $object = new Don($db); $object->fetch($id,$ref); - $head = donation_prepare_head($object); + $head = donation_prepare_head($object); - dol_fiche_head($head, 'note', $langs->trans("Donation"), 0, 'generic'); - - $linkback = ''.$langs->trans("BackToList").''; - - print ''; + dol_fiche_head($head, 'note', $langs->trans("Donation"), 0, 'generic'); - // Ref - print ''; + $linkback = ''.$langs->trans("BackToList").''; - print "
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', ''); - print '
"; + $morehtmlref='
'; + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.=$langs->trans('Project') . ' '; + if ($user->rights->don->creer) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; - print '
'; + dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref); + print '
'; + print '
'; + + $cssclass="titlefield"; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; dol_fiche_end(); } - llxFooter(); $db->close(); From c187f95269e72d8bd6d3d6e85a526054adca8d4d Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 20 Dec 2016 21:59:05 +0100 Subject: [PATCH 13/36] Social contribution : Complete work on dol_banner --- htdocs/compta/sociales/card.php | 3 +- htdocs/compta/sociales/document.php | 81 ++++++++++------------------- htdocs/compta/sociales/info.php | 43 ++++++++++++--- 3 files changed, 65 insertions(+), 62 deletions(-) diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 3816fa6ee58..e917e1e1c71 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -269,8 +269,9 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->char $form = new Form($db); $formsocialcontrib = new FormSocialContrib($db); +$title = $langs->trans("SocialContribution") . ' - ' . $langs->trans("Card"); $help_url='EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:Módulo Impuestos y cargas sociales (IVA, impuestos)'; -llxHeader("",$langs->trans("SocialContribution"),$help_url); +llxHeader("",$title,$help_url); // Mode creation diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php index 926e6232581..a6f4bc10daf 100644 --- a/htdocs/compta/sociales/document.php +++ b/htdocs/compta/sociales/document.php @@ -75,6 +75,13 @@ $modulepart='tax'; include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; +if ($action == 'setlib' && $user->rights->tax->charges->creer) +{ + $object->fetch($id); + $result = $object->setValueFrom('libelle', GETPOST('lib'), '', '', 'text', '', $user, 'TAX_MODIFY'); + if ($result < 0) + setEventMessages($object->error, $object->errors, 'errors'); +} /* * View @@ -82,8 +89,9 @@ include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; $form = new Form($db); +$title = $langs->trans("SocialContribution") . ' - ' . $langs->trans("Documents"); $help_url='EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:Módulo Impuestos y cargas sociales (IVA, impuestos)'; -llxHeader("",$langs->trans("SocialContribution"),$help_url); +llxHeader("",$title,$help_url); if ($object->id) { @@ -93,6 +101,20 @@ if ($object->id) dol_fiche_head($head, 'documents', $langs->trans("SocialContribution"), 0, 'bill'); + $morehtmlref='
'; + // Label of social contribution + $morehtmlref.=$form->editfieldkey("Label", 'lib', $object->lib, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("Label", 'lib', $object->lib, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1); + $morehtmlref.='
'; + + $linkback = '' . $langs->trans("BackToList") . ''; + + $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + + print '
'; + print '
'; // Construit liste des fichiers $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); @@ -105,62 +127,15 @@ if ($object->id) print ''; - // Ref - print '"; - - // Label - if ($action == 'edit') - { - print ''; - } - else - { - print ''; - } - - // Type - print ""; - - // Period end date - print ""; - print ""; - print ""; - - // Due date - if ($action == 'edit') - { - print '"; - } - else { - print ""; - } - - // Amount - print ''; - - // Status - print ''; - - print ''; + print ''; print ''; print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object,'id'); - print "
'.$langs->trans("Label").''; - print ''; - print '
'.$langs->trans("Label").''.$object->lib.'
".$langs->trans("Type")."".$object->type_libelle."
".$langs->trans("PeriodEndDate").""; - if ($action == 'edit') - { - print $form->select_date($object->periode, 'period', 0, 0, 0, 'charge', 1); - } - else - { - print dol_print_date($object->periode,"day"); - } - print "
'.$langs->trans("DateDue").""; - print $form->select_date($object->date_ech, 'ech', 0, 0, 0, 'charge', 1); - print "
".$langs->trans("DateDue")."".dol_print_date($object->date_ech,'day')."
'.$langs->trans("AmountTTC").''.price($object->amount,0,$outputlangs,1,-1,-1,$conf->currency).'
'.$langs->trans("Status").''.$object->getLibStatut(4,$alreadypayed).'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; print '
'; + + print '
'; + + dol_fiche_end(); $modulepart = 'tax'; $permission = $user->rights->tax->charges->creer; diff --git a/htdocs/compta/sociales/info.php b/htdocs/compta/sociales/info.php index c41787b7d08..ff905f1ee6c 100644 --- a/htdocs/compta/sociales/info.php +++ b/htdocs/compta/sociales/info.php @@ -37,25 +37,52 @@ $socid = GETPOST('socid','int'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'tax', $id, 'chargesociales','charges'); +/* + * Actions + */ + +if ($action == 'setlib' && $user->rights->tax->charges->creer) +{ + $object->fetch($id); + $result = $object->setValueFrom('libelle', GETPOST('lib'), '', '', 'text', '', $user, 'TAX_MODIFY'); + if ($result < 0) + setEventMessages($object->error, $object->errors, 'errors'); +} /* * View */ +$title = $langs->trans("SocialContribution") . ' - ' . $langs->trans("Info"); +$help_url = 'EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:Módulo Impuestos y cargas sociales (IVA, impuestos)'; +llxHeader("",$title,$help_url); -$help_url='EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:Módulo Impuestos y cargas sociales (IVA, impuestos)'; -llxHeader("",$langs->trans("SocialContribution"),$help_url); +$object = new ChargeSociales($db); +$object->fetch($id); +$object->info($id); -$chargesociales = new ChargeSociales($db); -$chargesociales->fetch($id); -$chargesociales->info($id); - -$head = tax_prepare_head($chargesociales); +$head = tax_prepare_head($object); dol_fiche_head($head, 'info', $langs->trans("SocialContribution"), 0, 'bill'); +$morehtmlref='
'; +// Label of social contribution +$morehtmlref.=$form->editfieldkey("Label", 'lib', $object->lib, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1); +$morehtmlref.=$form->editfieldval("Label", 'lib', $object->lib, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1); +$morehtmlref.='
'; + +$linkback = '' . $langs->trans("BackToList") . ''; + +$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status + +dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + +print '
'; +print '
'; + +print '
'; print '
'; -dol_print_object_info($chargesociales); +dol_print_object_info($object); print '
'; print '
'; From ae7f49b5d81d0cd44528738e9ef129bcc600ea59 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Wed, 21 Dec 2016 18:40:05 +0100 Subject: [PATCH 14/36] FIX: Deposits and credit notes weren't added in the received and pending columns --- htdocs/compta/facture/list.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index d9e5ae8ce23..8d0cc61d5d6 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -1216,6 +1216,12 @@ if ($resql) $facturestatic->type=$obj->type; $facturestatic->statut=$obj->fk_statut; $facturestatic->date_lim_reglement=$db->jdate($obj->datelimite); + + $paiement = $facturestatic->getSommePaiement(); + $totalcreditnotes = $facturestatic->getSumCreditNotesUsed(); + $totaldeposits = $facturestatic->getSumDepositsUsed(); + $totalpay = $paiement + $totalcreditnotes + $totaldeposits; + $remaintopay = $obj->total_ttc - $totalpay; print ''; if (! empty($arrayfields['f.facnumber']['checked'])) @@ -1223,9 +1229,7 @@ if ($resql) print ''; $notetoshow=dol_string_nohtmltag(($user->societe_id>0?$obj->note_public:$obj->note_private),1); - $paiement = $facturestatic->getSommePaiement(); - $remaintopay = $obj->total_ttc - $paiement; - + print ''; print ''; // TODO Use a denormalized field + print ''; // TODO Use a denormalized field if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalamfield']=$totalarray['nbfield']; - $totalarray['totalam'] += $paiement; + $totalarray['totalam'] += $totalpay; } if (! empty($arrayfields['rtp']['checked'])) From d53a238b49fd0425a8fae52f310f0602a567b61e Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 22 Dec 2016 06:12:42 +0100 Subject: [PATCH 15/36] Fix: Accountancy - Problem on quadratus export --- htdocs/accountancy/class/accountancyexport.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 268b5fa69c2..524326e320c 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -357,7 +357,7 @@ class AccountancyExport $Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_compte, 20), 20); $Tab['sens'] = $data->sens; // C or D $Tab['signe_montant'] = '+'; - $Tab['montant'] = str_pad(abs($data->montant) * 100, 12, '0', STR_PAD_LEFT); // TODO manage negative amount + $Tab['montant'] = str_pad(abs($data->montant), 12, '0', STR_PAD_LEFT); // TODO manage negative amount $Tab['contrepartie'] = str_repeat(' ', 8); if (! empty($data->date_echeance)) $Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE); From 6caa3408eddcb8d059084033ca8745ec62733059 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 22 Dec 2016 06:23:43 +0100 Subject: [PATCH 16/36] Remove field Skype. Already present in dol_banner_tab. --- htdocs/comm/card.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 3c2608b8088..6f6a5516aab 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -247,12 +247,6 @@ if ($id > 0) print ''; } - // Skype - if (! empty($conf->skype->enabled)) - { - print ''; - } - // Assujeti a TVA ou pas print ''; print '
'; @@ -1372,10 +1376,10 @@ if ($resql) if (! empty($arrayfields['dynamount_payed']['checked'])) { - print ''.(! empty($paiement)?price($paiement,0,$langs):' ').''.(! empty($totalpay)?price($totalpay,0,$langs):' ').'
'.$langs->trans('Skype').''.dol_print_skype($object->skype,0,$object->id,'AC_SKYPE').'
'.$langs->trans('VATIsUsed').''; From 1e1028605de3c3bcf1016689442d2a45568d6c96 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Dec 2016 00:23:57 +0100 Subject: [PATCH 17/36] FIX If mysql server is distant, the creation of user must use % as host with mysql. --- htdocs/core/db/mysqli.class.php | 2 +- htdocs/install/default.css | 163 ++++++++++++++++++-------------- htdocs/install/step1.php | 13 ++- 3 files changed, 102 insertions(+), 76 deletions(-) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index d7ff764ce7a..24ed1425f6b 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -810,7 +810,7 @@ class DoliDBMysqli extends DoliDB /** * Create a user and privileges to connect to database (even if database does not exists yet) * - * @param string $dolibarr_main_db_host Ip serveur + * @param string $dolibarr_main_db_host Ip server or '%' * @param string $dolibarr_main_db_user Nom user a creer * @param string $dolibarr_main_db_pass Mot de passe user a creer * @param string $dolibarr_main_db_name Database name where user must be granted diff --git a/htdocs/install/default.css b/htdocs/install/default.css index 4d1f9259813..07e57668a1f 100644 --- a/htdocs/install/default.css +++ b/htdocs/install/default.css @@ -15,55 +15,31 @@ * along with this program. If not, see . */ -.minwidth100 { min-width: 100px; } -.minwidth200 { min-width: 200px; } -.minwidth300 { min-width: 300px; } -.minwidth400 { min-width: 400px; } -.minwidth500 { min-width: 500px; } -.minwidth50imp { min-width: 50px !important; } -.minwidth100imp { min-width: 100px !important; } -.minwidth200imp { min-width: 200px !important; } -.minwidth300imp { min-width: 300px !important; } -.minwidth400imp { min-width: 400px !important; } -.minwidth500imp { min-width: 500px !important; } -/* Force values for small screen 570 */ -@media only screen and (max-width: 570px) -{ - input, input[type=text], input[type=password], select, textarea { - min-width: 20px; - min-height: 1.4em; - line-height: 1.4em; - padding: .4em .1em; - border: 1px solid #BBB; - /* max-width: inherit; why this ? */ - } - - .hideonsmartphone { display: none; } - .noenlargeonsmartphone { width : 50px !important; display: inline !important; } - .maxwidthonsmartphone { max-width: 100px; } - .maxwidth50onsmartphone { max-width: 40px; } - .maxwidth75onsmartphone { max-width: 50px; } - .maxwidth100onsmartphone { max-width: 70px; } - .maxwidth150onsmartphone { max-width: 120px; } - .maxwidth200onsmartphone { max-width: 200px; } - .maxwidth300onsmartphone { max-width: 300px; } - .maxwidth400onsmartphone { max-width: 400px; } - .minwidth50imp { min-width: 50px !important; } - .minwidth100imp { min-width: 50px !important; } - .minwidth200imp { min-width: 50px !important; } - .minwidth300imp { min-width: 50px !important; } - .minwidth400imp { min-width: 50px !important; } - .minwidth500imp { min-width: 50px !important; } -} body { - font-size:13px; - font-family: Verdana, Arial, Helvetica, Tahoma, sans-serif; - background: #fcfcfc; + font-size:14px; + font-family: roboto,arial,tahoma,verdana,helvetica; + /* background: #fcfcfc; */ margin: 15px 30px 10px; } +table.main-inside { + padding-left: 10px; + padding-right: 10px; + margin-bottom: 10px; + margin-top: 10px; + color: #000000; +} + +table.main { + padding-left: 6px; + padding-right: 6px; + padding-top: 12px; + padding-bottom: 12px; + background-color: #fff; +} + div.titre { padding: 5px 5px 5px 5px; margin: 0 0 0 0; @@ -90,6 +66,74 @@ div.soustitre { text-align: right; } +.minwidth100 { min-width: 100px; } +.minwidth200 { min-width: 200px; } +.minwidth300 { min-width: 300px; } +.minwidth400 { min-width: 400px; } +.minwidth500 { min-width: 500px; } +.minwidth50imp { min-width: 50px !important; } +.minwidth100imp { min-width: 100px !important; } +.minwidth200imp { min-width: 200px !important; } +.minwidth300imp { min-width: 300px !important; } +.minwidth400imp { min-width: 400px !important; } +.minwidth500imp { min-width: 500px !important; } + + +/* Force values for small screen 570 */ +@media only screen and (max-width: 570px) +{ + body { + margin: 15px 4px 4px; + } + + input, input[type=text], input[type=password], select, textarea { + min-width: 20px; + min-height: 1.4em; + line-height: 1.4em; + padding: .4em .1em; + border: 1px solid #BBB; + /* max-width: inherit; why this ? */ + } + + .hideonsmartphone { display: none; } + .noenlargeonsmartphone { width : 50px !important; display: inline !important; } + .maxwidthonsmartphone { max-width: 100px; } + .maxwidth50onsmartphone { max-width: 40px; } + .maxwidth75onsmartphone { max-width: 50px; } + .maxwidth100onsmartphone { max-width: 70px; } + .maxwidth150onsmartphone { max-width: 120px; } + .maxwidth200onsmartphone { max-width: 200px; } + .maxwidth300onsmartphone { max-width: 300px; } + .maxwidth400onsmartphone { max-width: 400px; } + .minwidth50imp { min-width: 50px !important; } + .minwidth100imp { min-width: 50px !important; } + .minwidth200imp { min-width: 50px !important; } + .minwidth300imp { min-width: 50px !important; } + .minwidth400imp { min-width: 50px !important; } + .minwidth500imp { min-width: 50px !important; } + + table.main { + padding-left: 0; + padding-right: 0; + } + + table.main-inside { + padding-left: 1px; + padding-right: 1px; + } + + span.titre { + font-size: 90%; + font-weight: normal; + background: #FFFFFF; + color: #444; + border: 1px solid #999; + padding: 5px 5px 5px 5px; + margin: 0 0 0 4px; + } +} + + input:disabled { background: #FDFDFD; @@ -150,33 +194,12 @@ input:-webkit-autofill { -webkit-box-shadow: 0 0 0 50px #FBFFEA inset; } -table.main { - padding-left: 6px; - padding-right: 6px; - padding-top: 12px; - padding-bottom: 12px; - border: 1px solid #A0A0A0; - border-radius: 8px; - border: solid 1px rgba(90,90,90,.4); - background-color: #fff; - -moz-box-shadow: 0px 1px 6px 2px rgba(0, 0, 0, 0.2); - -webkit-box-shadow: 0px 1px 6px 2px rgba(0, 0, 0, 0.2); - box-shadow: 0px 1px 6px 2px rgba(0, 0, 0, 0.2); -} - -table.main-inside { - padding-left: 10px; - padding-right: 10px; - margin-bottom: 10px; - margin-top: 10px; - color: #000000; -} - table.listofchoices, tr.listofchoices, td.listofchoices { border-collapse: collapse; padding: 4px; color: #000000; - border: 1px solid #999 !important; + border: 1px solid #ccc !important; + line-height: 18px; } tr.listofchoices { @@ -257,7 +280,6 @@ a.titre { div.comment { text-decoration:none; color:black; - font-size: 13px; } h3 { @@ -293,9 +315,6 @@ td.comment { font-size: 12px; border-bottom: 1px solid #CCCCDB; } -table { - font-size: 13px; -} .install { @@ -319,8 +338,8 @@ ul { .button { - background: #FFFFFF bottom; - border: 1px solid #C0C0C0; + background: #eee; + /*border: 1px solid #C0C0C0;*/ padding: 0.3em 0.7em; margin: 0 0.5em; -moz-border-radius:0 5px 0 5px; diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index 4389cbf2c0d..7f9c1a2fc4b 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2005-2011 Regis Houssin @@ -129,7 +129,6 @@ if (@file_exists($forcedfile)) { } } -dolibarr_install_syslog("--- step1: entering step1.php page"); $error = 0; @@ -138,6 +137,7 @@ $error = 0; * View */ +dolibarr_install_syslog("--- step1: entering step1.php page"); pHeader($langs->trans("ConfigurationFile"),"step2"); @@ -541,7 +541,14 @@ if (! $error && $db->connected && $action == "set") { if ($db->connected) { - $result=$db->DDLCreateUser($dolibarr_main_db_host,$dolibarr_main_db_user,$dolibarr_main_db_pass,$dolibarr_main_db_name); + // Create user + $tmpdolibarr_main_db_host = $dolibarr_main_db_host; + if ($databasefortest == 'mysql') + { + if (! in_array($conf->db->host, array('127.0.0.1', 'localhost', 'localhost.local'))) $tmpdolibarr_main_db_host='%'; + } + + $result=$db->DDLCreateUser($tmpdolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name); if ($result > 0) { From 2bfbf0f6a705992b42d35cd7c9e913e1676857e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Dec 2016 00:28:16 +0100 Subject: [PATCH 18/36] Fix css --- htdocs/install/default.css | 9 +++++++-- htdocs/install/fileconf.php | 2 +- htdocs/install/inc.php | 11 ++++++----- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/htdocs/install/default.css b/htdocs/install/default.css index 07e57668a1f..dfde26cdedb 100644 --- a/htdocs/install/default.css +++ b/htdocs/install/default.css @@ -27,9 +27,13 @@ body { table.main-inside { padding-left: 10px; padding-right: 10px; + padding-bottom: 10px; margin-bottom: 10px; margin-top: 10px; color: #000000; + border-top: 1px solid #ccc; + border-bottom: 1px solid #ccc; + line-height: 22px; } table.main { @@ -119,7 +123,8 @@ div.soustitre { table.main-inside { padding-left: 1px; - padding-right: 1px; + padding-right: 1px; + line-height: 20px; } span.titre { @@ -250,7 +255,7 @@ font.error { /* Next button */ div.nextbutton { - text-align: right; + text-align: center; margin-top: 10px; padding-top: 5px; padding-bottom: 5px; diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index 73357faa5db..32dff5f10ef 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -72,7 +72,7 @@ if (@file_exists($forcedfile)) { session_start(); // To be able to keep info into session (used for not loosing pass during navigation. pass must not transit throug parmaeters) -pHeader($langs->trans("ConfigurationFile"),"step1","set","",(empty($force_dolibarr_js_JQUERY)?'':$force_dolibarr_js_JQUERY.'/')); +pHeader($langs->trans("ConfigurationFile"), "step1", "set", "", (empty($force_dolibarr_js_JQUERY)?'':$force_dolibarr_js_JQUERY.'/'), 'main-inside-bis'); // Test if we can run a first install process if (! is_writable($conffile)) diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index 2558c72feca..0a6c76fa786 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -359,9 +359,10 @@ function conf($dolibarr_main_document_root) * @param string $action Action code ('set' or 'upgrade') * @param string $param Param * @param string $forcejqueryurl Set jquery relative URL (must end with / if defined) + * @param string $csstable Css for table * @return void */ -function pHeader($subtitle,$next,$action='set',$param='',$forcejqueryurl='') +function pHeader($subtitle,$next,$action='set',$param='',$forcejqueryurl='',$csstable='main-inside') { global $conf; global $langs; @@ -406,10 +407,10 @@ function pHeader($subtitle,$next,$action='set',$param='',$forcejqueryurl='') print ''."\n"; - print '
'; - print 'Dolibarr logo
'; + print '
'; + print 'Dolibarr logo
'; print DOL_VERSION; - print '


'; + print '

'; print ''.$langs->trans("DolibarrSetup"); if ($subtitle) { @@ -423,7 +424,7 @@ function pHeader($subtitle,$next,$action='set',$param='',$forcejqueryurl='') print '
'."\n"; - print '
'."\n"; + print '
'."\n"; } /** From f9d29bbe25feb8823ff618416948752a63427b1d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Dec 2016 01:25:40 +0100 Subject: [PATCH 19/36] Complete sample of setup files --- dev/setup/nginx/dolibarr | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 dev/setup/nginx/dolibarr diff --git a/dev/setup/nginx/dolibarr b/dev/setup/nginx/dolibarr new file mode 100644 index 00000000000..82b8d2dc7bf --- /dev/null +++ b/dev/setup/nginx/dolibarr @@ -0,0 +1,28 @@ +# Dolibarr server configuration sample for NGinx +server { + listen 80; + listen [::]:80; + + root /path/to/your/htdocs; + + # Optionnal + error_log /path/to/your/log/directory/nginx.error.log; + access_log /path/to/your/log/directory/nginx.access.log; + + index index.php index.html index.htm; + + # Optionnal + server_name your-fqdn.tld; + + location / { + try_files $uri $uri/ /index.php; + } + + location ~ [^/]\.php(/|$) { + try_files $uri =404; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_read_timeout 600; + include fastcgi_params; + fastcgi_pass unix:/var/run/php5-fpm.sock; + } +} From 9e44eb0d1548c4ad77f10eed2baa5fdc88af6b26 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Dec 2016 02:08:22 +0100 Subject: [PATCH 20/36] Fix return code REST similar for all api with POST --- htdocs/adherents/class/api_members.class.php | 4 ++-- htdocs/adherents/class/api_subscriptions.class.php | 4 ++-- htdocs/categories/class/api_categories.class.php | 4 ++-- .../class/api_deprecated_category.class.php | 2 +- htdocs/comm/action/class/api_agendaevents.class.php | 5 ++--- htdocs/comm/propal/class/api_proposals.class.php | 5 ++--- htdocs/commande/class/api_orders.class.php | 5 ++--- htdocs/compta/bank/class/api_bankaccounts.class.php | 2 +- htdocs/compta/facture/class/api_invoices.class.php | 5 ++--- .../class/api_expensereports.class.php | 5 ++--- htdocs/fourn/class/api_supplier_invoices.class.php | 5 ++--- .../product/class/api_deprecated_product.class.php | 2 +- htdocs/product/class/api_products.class.php | 5 ++--- htdocs/product/stock/class/api_warehouses.class.php | 4 ++-- htdocs/projet/class/api_projects.class.php | 5 ++--- htdocs/projet/class/api_tasks.class.php | 5 ++--- htdocs/societe/class/api_contacts.class.php | 5 ++++- htdocs/societe/class/api_thirdparties.class.php | 5 ++++- htdocs/societe/class/societe.class.php | 6 +++--- htdocs/user/class/api_users.class.php | 13 +++++-------- 20 files changed, 45 insertions(+), 51 deletions(-) diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index 779b5213666..9ea36bf579a 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -170,8 +170,8 @@ class Members extends DolibarrApi foreach($request_data as $field => $value) { $member->$field = $value; } - if($member->create(DolibarrApiAccess::$user) < 0) { - throw new RestException(503, 'Error when create member : '.$member->error); + if ($member->create(DolibarrApiAccess::$user) < 0) { + throw new RestException(500, 'Error creating member', array_merge(array($member->error), $member->errors)); } return $member->id; } diff --git a/htdocs/adherents/class/api_subscriptions.class.php b/htdocs/adherents/class/api_subscriptions.class.php index 1917e3b84ed..4e1d58971cb 100644 --- a/htdocs/adherents/class/api_subscriptions.class.php +++ b/htdocs/adherents/class/api_subscriptions.class.php @@ -162,8 +162,8 @@ class Subscriptions extends DolibarrApi foreach($request_data as $field => $value) { $subscription->$field = $value; } - if($subscription->create(DolibarrApiAccess::$user) < 0) { - throw new RestException(503, 'Error when create subscription : '.$subscription->error); + if ($subscription->create(DolibarrApiAccess::$user) < 0) { + throw new RestException(500, 'Error when creating subscription', array_merge(array($subscription->error), $subscription->errors)); } return $subscription->id; } diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 921198ab1be..4904bbea3b7 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -269,8 +269,8 @@ class Categories extends DolibarrApi foreach($request_data as $field => $value) { $this->category->$field = $value; } - if($this->category->create(DolibarrApiAccess::$user) < 0) { - throw new RestException(503, 'Error when create category : '.$this->category->error); + if ($this->category->create(DolibarrApiAccess::$user) < 0) { + throw new RestException(500, 'Error when creating category', array_merge(array($this->category->error), $this->category->errors)); } return $this->category->id; } diff --git a/htdocs/categories/class/api_deprecated_category.class.php b/htdocs/categories/class/api_deprecated_category.class.php index 8ec125290c5..62f92b71bea 100644 --- a/htdocs/categories/class/api_deprecated_category.class.php +++ b/htdocs/categories/class/api_deprecated_category.class.php @@ -395,7 +395,7 @@ class CategoryApi extends DolibarrApi $this->category->$field = $value; } if($this->category->create(DolibarrApiAccess::$user) < 0) { - throw new RestException(503, 'Error when create category : '.$this->category->error); + throw new RestException(500, 'Error when create category : '.$this->category->error); } return $this->category->id; } diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index 7d66dccdd63..b14d48c174e 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -194,9 +194,8 @@ class AgendaEvents extends DolibarrApi } $this->expensereport->lines = $lines; }*/ - if ($this->actioncomm->create(DolibarrApiAccess::$user) <= 0) { - $errormsg = $this->actioncomm->error; - throw new RestException(500, $errormsg ? $errormsg : "Error while creating actioncomm"); + if ($this->actioncomm->create(DolibarrApiAccess::$user) < 0) { + throw new RestException(500, "Error creating event", array_merge(array($this->actioncomm->error), $this->actioncomm->errors)); } return $this->actioncomm->id; diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 6ceac37a535..0440793ceac 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -190,9 +190,8 @@ class Proposals extends DolibarrApi } $this->propal->lines = $lines; }*/ - if ($this->propal->create(DolibarrApiAccess::$user) <= 0) { - $errormsg = $this->propal->error; - throw new RestException(500, $errormsg ? $errormsg : "Error while creating order"); + if ($this->propal->create(DolibarrApiAccess::$user) < 0) { + throw new RestException(500, "Error creating order", array_merge(array($this->propal->error), $this->propal->errors)); } return $this->propal->id; diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 984ef5e6f43..e0ab753c64c 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -195,9 +195,8 @@ class Orders extends DolibarrApi } $this->commande->lines = $lines; }*/ - if ($this->commande->create(DolibarrApiAccess::$user) <= 0) { - $errormsg = $this->commande->error; - throw new RestException(500, $errormsg ? $errormsg : "Error while creating order"); + if ($this->commande->create(DolibarrApiAccess::$user) < 0) { + throw new RestException(500, "Error creating order", array_merge(array($this->commande->error), $this->commande->errors)); } return $this->commande->id; diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index d6fb3515c81..7eaf673c2e7 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -160,7 +160,7 @@ class BankAccounts extends DolibarrApi $account->courant = $account->type; if ($account->create(DolibarrApiAccess::$user) < 0) { - throw new RestException(503, 'Error when creating account: ' . $account->error); + throw new RestException(500, 'Error creating bank account', array_merge(array($account->error), $account->errors)); } return $account->id; } diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 6fc96a4dfe6..4efc997cc42 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -203,9 +203,8 @@ class Invoices extends DolibarrApi $this->invoice->lines = $lines; }*/ - if ($this->invoice->create(DolibarrApiAccess::$user) <= 0) { - $errormsg = $this->invoice->error; - throw new RestException(500, $errormsg ? $errormsg : "Error while creating order"); + if ($this->invoice->create(DolibarrApiAccess::$user) < 0) { + throw new RestException(500, "Error creating invoice", array_merge(array($this->invoice->error), $this->invoice->errors)); } return $this->invoice->id; } diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php index cb506d32cdf..94d41e432f3 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -177,9 +177,8 @@ class ExpenseReports extends DolibarrApi } $this->expensereport->lines = $lines; }*/ - if ($this->expensereport->create(DolibarrApiAccess::$user) <= 0) { - $errormsg = $this->expensereport->error; - throw new RestException(500, $errormsg ? $errormsg : "Error while creating expensereport"); + if ($this->expensereport->create(DolibarrApiAccess::$user) < 0) { + throw new RestException(500, "Error creating expensereport", array_merge(array($this->expensereport->error), $this->expensereport->errors)); } return $this->expensereport->id; diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index cca9743927b..59e9db1324d 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -203,9 +203,8 @@ class SupplierInvoices extends DolibarrApi $this->invoice->lines = $lines; }*/ - if ($this->invoice->create(DolibarrApiAccess::$user) <= 0) { - $errormsg = $this->invoice->error; - throw new RestException(500, $errormsg ? $errormsg : "Error while creating order"); + if ($this->invoice->create(DolibarrApiAccess::$user) < 0) { + throw new RestException(500, "Error creating order", array_merge(array($this->invoice->error), $this->invoice->errors)); } return $this->invoice->id; } diff --git a/htdocs/product/class/api_deprecated_product.class.php b/htdocs/product/class/api_deprecated_product.class.php index 938e591226f..df0cddd8aaf 100644 --- a/htdocs/product/class/api_deprecated_product.class.php +++ b/htdocs/product/class/api_deprecated_product.class.php @@ -275,7 +275,7 @@ class ProductApi extends DolibarrApi } $result = $this->product->create(DolibarrApiAccess::$user); if($result < 0) { - throw new RestException(503,'Error when creating product : '.$this->product->error); + throw new RestException(500,'Error when creating product : '.$this->product->error); } return $this->product->id; diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 81b4458706c..90bc9d7296f 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -182,9 +182,8 @@ class Products extends DolibarrApi foreach($request_data as $field => $value) { $this->product->$field = $value; } - $result = $this->product->create(DolibarrApiAccess::$user); - if($result < 0) { - throw new RestException(503,'Error when creating product : '.$this->product->error); + if ($this->product->create(DolibarrApiAccess::$user) < 0) { + throw new RestException(500, "Error creating product", array_merge(array($this->product->error), $this->product->errors)); } return $this->product->id; diff --git a/htdocs/product/stock/class/api_warehouses.class.php b/htdocs/product/stock/class/api_warehouses.class.php index d19918f0789..d09c7bc527f 100644 --- a/htdocs/product/stock/class/api_warehouses.class.php +++ b/htdocs/product/stock/class/api_warehouses.class.php @@ -169,8 +169,8 @@ class Warehouses extends DolibarrApi foreach($request_data as $field => $value) { $this->warehouse->$field = $value; } - if($this->warehouse->create(DolibarrApiAccess::$user) <= 0) { - throw new RestException(503, 'Error when create warehouse : '.$this->warehouse->error); + if ($this->warehouse->create(DolibarrApiAccess::$user) < 0) { + throw new RestException(500, "Error creating warehouse", array_merge(array($this->warehouse->error), $this->warehouse->errors)); } return $this->warehouse->id; } diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php index 78e7954a097..5bb7e8dfc7e 100644 --- a/htdocs/projet/class/api_projects.class.php +++ b/htdocs/projet/class/api_projects.class.php @@ -196,9 +196,8 @@ class Projects extends DolibarrApi } $this->project->lines = $lines; }*/ - if ($this->project->create(DolibarrApiAccess::$user) <= 0) { - $errormsg = $this->project->error; - throw new RestException(500, $errormsg ? $errormsg : "Error while creating project"); + if ($this->project->create(DolibarrApiAccess::$user) < 0) { + throw new RestException(500, "Error creating project", array_merge(array($this->project->error), $this->project->errors)); } return $this->project->id; diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php index 1678e43328f..ad72a36fa45 100644 --- a/htdocs/projet/class/api_tasks.class.php +++ b/htdocs/projet/class/api_tasks.class.php @@ -203,9 +203,8 @@ class Tasks extends DolibarrApi } $this->project->lines = $lines; }*/ - if ($this->task->create(DolibarrApiAccess::$user) <= 0) { - $errormsg = $this->task->error; - throw new RestException(500, $errormsg ? $errormsg : "Error while creating task"); + if ($this->task->create(DolibarrApiAccess::$user) < 0) { + throw new RestException(500, "Error creating task", array_merge(array($this->task->error), $this->task->errors)); } return $this->task->id; diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index da8e930a0ce..d758d9ac3f4 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -192,7 +192,10 @@ class Contacts extends DolibarrApi { $this->contact->$field = $value; } - return $this->contact->create(DolibarrApiAccess::$user); + if ($this->contact->create(DolibarrApiAccess::$user) < 0) { + throw new RestException(500, "Error creating contact", array_merge(array($this->contact->error), $this->contact->errors)); + } + return $this->contact->id; } /** diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 674d8abcf42..d8430fedb76 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -192,7 +192,10 @@ class Thirdparties extends DolibarrApi foreach($request_data as $field => $value) { $this->company->$field = $value; } - return $this->company->create(DolibarrApiAccess::$user); + if ($this->company->create(DolibarrApiAccess::$user) < 0) + throw new RestException(503, 'Error creating thirdparty', array_merge(array($this->company->error), $this->company->errors)); + + return $this->company->id; } /** diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index c89be8f72d3..4bff08c71dd 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -496,9 +496,9 @@ class Societe extends CommonObject } else { - dol_syslog(get_class($this)."::Create echec update ".$this->error, LOG_ERR); + dol_syslog(get_class($this)."::Create echec update ".$this->error." ".join(',',$this->errors), LOG_ERR); $this->db->rollback(); - return -3; + return -4; } } else @@ -520,7 +520,7 @@ class Societe extends CommonObject } else - { + { $this->db->rollback(); dol_syslog(get_class($this)."::Create fails verify ".join(',',$this->errors), LOG_WARNING); return -3; diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index 3fc44104628..a759f1dfe08 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -174,19 +174,16 @@ class Users extends DolibarrApi if (!isset($request_data["lastname"])) throw new RestException(400, "lastname field missing");*/ //assign field values - $xxx=var_export($request_data, true); - dol_syslog("xxx=".$xxx); foreach ($request_data as $field => $value) { $this->useraccount->$field = $value; } - - $result = $this->useraccount->create(DolibarrApiAccess::$user); - if ($result <=0) { - throw new RestException(500, "User not created : ".$this->useraccount->error); + + if ($this->useraccount->create(DolibarrApiAccess::$user) < 0) { + throw new RestException(500, 'Error creating', array_merge(array($this->useraccount->error), $this->useraccount->errors)); } - return array('id'=>$result); - } + return $this->useraccount->id; + } /** From da1d4d80f2c4eaac699026ebfff69905c18a2f48 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Dec 2016 02:09:26 +0100 Subject: [PATCH 21/36] Fix return code REST similar for all api with POST --- htdocs/societe/class/api_thirdparties.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index d8430fedb76..cedd30c5209 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -193,7 +193,7 @@ class Thirdparties extends DolibarrApi $this->company->$field = $value; } if ($this->company->create(DolibarrApiAccess::$user) < 0) - throw new RestException(503, 'Error creating thirdparty', array_merge(array($this->company->error), $this->company->errors)); + throw new RestException(500, 'Error creating thirdparty', array_merge(array($this->company->error), $this->company->errors)); return $this->company->id; } From b777ec79f29d9b854862c0ff045d19e29b98ef8e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Dec 2016 10:38:27 +0100 Subject: [PATCH 22/36] Fix contextpage implementation into skeleton --- dev/skeletons/skeleton_list.php | 6 +++++- htdocs/comm/action/class/api_agendaevents.class.php | 2 +- htdocs/commande/list.php | 3 ++- htdocs/core/menus/standard/eldy.lib.php | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index d937b34536f..0ca4d6f8589 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -89,8 +89,11 @@ if ($user->societe_id > 0) //accessforbidden(); } +// Initialize technical object to manage context to save list fields +$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'mymodulelist'; + // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array -$hookmanager->initHooks(array('skeletonlist')); +$hookmanager->initHooks(array('mymodulelist')); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels @@ -305,6 +308,7 @@ print ''; print ''; print ''; +print ''; print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit); diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index b14d48c174e..5eeca63a4aa 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -94,7 +94,7 @@ class AgendaEvents extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @param string $user_ids User ids filter field (owners of event). Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i} - * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.label:like:'%dol%') and (t.date_creation:<:'20160101')" * @return array Array of Agenda Events objects */ function index($sortfield = "t.id", $sortorder = 'ASC', $limit = 0, $page = 0, $user_ids = 0, $sqlfilters = '') { diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 0262187b342..9ca79421f20 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -99,7 +99,7 @@ if (! $sortfield) $sortfield='c.ref'; if (! $sortorder) $sortorder='DESC'; // Initialize technical object to manage context to save list fields -$contextpage='orderlist'; +$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'orderlist'; // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array($contextpage)); @@ -653,6 +653,7 @@ if ($resql) print ''; print ''; print ''; + print ''; print ''; print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index b95e0c5bd25..a88e180b16a 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -844,7 +844,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->commande->enabled)) { $langs->load("orders"); - if (! empty($conf->facture->enabled)) $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=-3&billed=0", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders'); + if (! empty($conf->facture->enabled)) $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=-3&billed=0&contextpage=billableorders", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders'); // if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire); } From 43942e6ea26216b0b1accc380e622c4b2a42c903 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Dec 2016 13:04:46 +0100 Subject: [PATCH 23/36] Fix css and fix navigation on resource tab. --- htdocs/core/class/html.form.class.php | 24 +++++----- htdocs/core/lib/functions.lib.php | 2 +- htdocs/core/lib/functions2.lib.php | 11 +++-- htdocs/core/tpl/extrafields_view.tpl.php | 9 +++- htdocs/core/tpl/resource_view.tpl.php | 22 ++++----- htdocs/fichinter/card.php | 10 ++-- htdocs/fichinter/class/fichinter.class.php | 2 +- htdocs/fichinter/contact.php | 8 +++- htdocs/fichinter/list.php | 2 +- htdocs/resource/element_resource.php | 41 ++++++----------- htdocs/theme/eldy/style.css.php | 53 +++++++++------------- htdocs/theme/md/style.css.php | 14 ++++-- 12 files changed, 100 insertions(+), 98 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8abe3f271f7..ad968de506a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5633,18 +5633,18 @@ class Form * Return a HTML area with the reference of object and a navigation bar for a business object * To add a particular filter on select, you must set $object->next_prev_filter to SQL criteria. * - * @param object $object Object to show - * @param string $paramid Name of parameter to use to name the id into the URL next/previous link - * @param string $morehtml More html content to output just before the nav bar - * @param int $shownav Show Condition (navigation is shown if value is 1) - * @param string $fieldid Name of field id into database to use for select next and previous (we make the select max and min on this field) + * @param object $object Object to show. + * @param string $paramid Name of parameter to use to name the id into the URL next/previous link. + * @param string $morehtml More html content to output just before the nav bar. + * @param int $shownav Show Condition (navigation is shown if value is 1). + * @param string $fieldid Name of field id into database to use for select next and previous (we make the select max and min on this field). * @param string $fieldref Name of field ref of object (object->ref) to show or 'none' to not show ref. - * @param string $morehtmlref More html to show after ref - * @param string $moreparam More param to add in nav link url. - * @param int $nodbprefix Do not include DB prefix to forge table name - * @param string $morehtmlleft More html code to show before ref - * @param string $morehtmlstatus More html code to show under navigation arrows (status place) - * @param string $morehtmlright More html code to show after ref + * @param string $morehtmlref More html to show after ref. + * @param string $moreparam More param to add in nav link url. Must start with '&...'. + * @param int $nodbprefix Do not include DB prefix to forge table name. + * @param string $morehtmlleft More html code to show before ref. + * @param string $morehtmlstatus More html code to show under navigation arrows (status place). + * @param string $morehtmlright More html code to show after ref. * @return string Portion HTML with ref + navigation buttons */ function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='',$nodbprefix=0,$morehtmlleft='',$morehtmlstatus='',$morehtmlright='') @@ -5657,7 +5657,7 @@ class Form //print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam"; $object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid,$nodbprefix); - + //$previous_ref = $object->ref_previous?''.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Previous"),'previous.png'):' ').'':''; //$next_ref = $object->ref_next?''.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Next"),'next.png'):' ').'':''; $previous_ref = $object->ref_previous?''.(($conf->dol_use_jmobile != 4)?'<':' ').'':''.(($conf->dol_use_jmobile != 4)?'<':' ').''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 98dc7f14fd4..bb268ffa2d0 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1103,7 +1103,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r $morehtmlref.=''; } - print '
'; + print '
'; print $form->showrefnav($object, $paramid, $morehtml, $shownav, $fieldid, $fieldref, $morehtmlref, $moreparam, $nodbprefix, $morehtmlleft, $morehtmlstatus, $morehtmlright); print '
'; print '
'; diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index a07c506d758..a09b962ee26 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -2007,13 +2007,14 @@ function getElementProperties($element_type) /** * Fetch an object from its id and element_type - * Inclusion classes is automatic + * Inclusion of classes is automatic * * @param int $element_id Element id * @param string $element_type Element type + * @param ref $element_ref Element ref (Use this if element_id but not both) * @return int|object object || 0 || -1 if error */ -function fetchObjectByElement($element_id, $element_type) +function fetchObjectByElement($element_id, $element_type, $element_ref='') { global $conf; global $db,$conf; @@ -2023,11 +2024,11 @@ function fetchObjectByElement($element_id, $element_type) { dol_include_once('/'.$element_prop['classpath'].'/'.$element_prop['classfile'].'.class.php'); - $objectstat = new $element_prop['classname']($db); - $ret = $objectstat->fetch($element_id); + $objecttmp = new $element_prop['classname']($db); + $ret = $objecttmp->fetch($element_id, $element_ref); if ($ret >= 0) { - return $objectstat; + return $objecttmp; } } return 0; diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index 4cfc4a20afb..fcb92f1b525 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -22,6 +22,9 @@ * * $cols */ +?> + +fetch_optionals($object->id, $extralabels); $parameters = array('colspan' => ' colspan="'.$cols.'"', 'cols' => $cols, 'socid' => $object->fk_soc); @@ -47,7 +50,9 @@ if (empty($reshook) && ! empty($extrafields->attribute_label)) { if (!empty($extrafields->attribute_hidden[$key])) print '
'; else print '
'; - print ''; + print ''; + print 'attribute_required[$key])) print ' class="fieldrequired"'; print '>' . $langs->trans($label) . ''; @@ -100,3 +105,5 @@ if (empty($reshook) && ! empty($extrafields->attribute_label)) } } } +?> + \ No newline at end of file diff --git a/htdocs/core/tpl/resource_view.tpl.php b/htdocs/core/tpl/resource_view.tpl.php index 6f88d8bb5f8..ecc9f32d837 100644 --- a/htdocs/core/tpl/resource_view.tpl.php +++ b/htdocs/core/tpl/resource_view.tpl.php @@ -10,21 +10,21 @@ print '
'; if($mode == 'edit' ) { print '
'; - print '
'.$langs->trans('Resource').'
'; - print '
'.$langs->trans('Type').'
'; - print '
'.$langs->trans('Busy').'
'; - print '
'.$langs->trans('Mandatory').'
'; - print '
'; + print '
'.$langs->trans('Resource').'
'; + print '
'.$langs->trans('Type').'
'; + print '
'.$langs->trans('Busy').'
'; + print '
'.$langs->trans('Mandatory').'
'; + print '
'; print ''; } else { print '
'; - print '
'.$langs->trans('Resource').'
'; - print '
'.$langs->trans('Type').'
'; - print '
'.$langs->trans('Busy').'
'; - print '
'.$langs->trans('Mandatory').'
'; - print '
'; + print '
'.$langs->trans('Resource').'
'; + print '
'.$langs->trans('Type').'
'; + print '
'.$langs->trans('Busy').'
'; + print '
'.$langs->trans('Mandatory').'
'; + print '
'; print ''; } @@ -66,7 +66,7 @@ if( (array) $linked_resources && count($linked_resources) > 0) print '
'; print $object_resource->getNomUrl(1); - print '
'; + print '
'; print '
'; print $object_resource->type_label; diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index fb37a235b37..9b0bb737128 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1395,10 +1395,12 @@ else if ($id > 0 || ! empty($ref)) print '
'; print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print "\n"; } $var=true; diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index a320c4ff7c7..2942a8903ab 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -383,7 +383,7 @@ class Fichinter extends CommonObject } else { - $this->error=$this->db->error(); + $this->error=$this->db->lasterror(); return -1; } } diff --git a/htdocs/fichinter/contact.php b/htdocs/fichinter/contact.php index ca1813ce3e2..83825b08a90 100644 --- a/htdocs/fichinter/contact.php +++ b/htdocs/fichinter/contact.php @@ -45,7 +45,11 @@ $result = restrictedArea($user, 'ficheinter', $id, 'fichinter'); $object = new Fichinter($db); $result = $object->fetch($id,$ref); - +if (! $result) +{ + print 'Record not found'; + exit; +} /* * Adding a new contact @@ -166,7 +170,7 @@ if ($id > 0 || ! empty($ref)) } $morehtmlref.=''; - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, 0, 0, '', '', 1); + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); dol_fiche_end(); diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index e350250a638..5126768c083 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -253,7 +253,7 @@ if ($result) print '
'.$langs->trans('Description').''.$langs->trans('Date').''.(empty($conf->global->FICHINTER_WITHOUT_DURATION)?$langs->trans('Duration'):'').' '.$langs->trans('Description').''.$langs->trans('Date').''.(empty($conf->global->FICHINTER_WITHOUT_DURATION)?$langs->trans('Duration'):'').'   
'; print ''; - if (! empty($arrayfields['f.ref']['checked'])) print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.ref","",$param,'width="15%"',$sortfield,$sortorder); + if (! empty($arrayfields['f.ref']['checked'])) print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.ref","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['f.description']['checked'])) print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"f.description","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['fd.description']['checked'])) print_liste_field_titre('',$_SERVER["PHP_SELF"],''); diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index 87354c6fd9d..14475c58203 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -51,13 +51,13 @@ $hookmanager->initHooks(array('element_resource')); $object->available_resources = array('dolresource'); // Get parameters -$id = GETPOST('id','int'); -$ref = GETPOST('ref','alpha'); +$id = GETPOST('id','int'); // resource id +$element_id = GETPOST('element_id','int'); // element_id +$element_ref = GETPOST('ref','alpha'); // element ref +$element = GETPOST('element','alpha'); // element_type $action = GETPOST('action','alpha'); $mode = GETPOST('mode','alpha'); $lineid = GETPOST('lineid','int'); -$element = GETPOST('element','alpha'); // element_type -$element_id = GETPOST('element_id','int'); $resource_id = GETPOST('fk_resource','int'); $resource_type = GETPOST('resource_type','alpha'); $busy = GETPOST('busy','int'); @@ -66,7 +66,7 @@ $cancel = GETPOST('cancel','alpha'); $confirm = GETPOST('confirm','alpha'); $socid = GETPOST('socid','int'); -if ($socid > 0) +if ($socid > 0) // Special for thirdparty { $element_id = $socid; $element = 'societe'; @@ -183,11 +183,11 @@ else // Specific to agenda module - if ($element_id && $element == 'action') + if (($element_id || $element_ref) && $element == 'action') { require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; - $act = fetchObjectByElement($element_id,$element); + $act = fetchObjectByElement($element_id,$element, $element_ref); if (is_object($act)) { @@ -212,16 +212,10 @@ else $linkback.=$out; - dol_banner_tab($act, 'element_id', $linkback, ($user->societe_id?0:1), 'id', 'ref', '', "&element=".$element); + dol_banner_tab($act, 'element_id', $linkback, ($user->societe_id?0:1), 'id', 'ref', '', '&element='.$element, 0, '', ''); print '
'; - // Ref - /*print '';*/ - - // Affichage fiche action en mode visu print '
'.$langs->trans("Ref").''; - print $form->showrefnav($act, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', ''); - print '
'; // Type @@ -248,11 +242,6 @@ else if ($act->percentage > 0 && $act->percentage < 100 && $act->datef && $act->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late")); print ''; - // Status - /*print '';*/ - // Location if (empty($conf->global->AGENDA_DISABLE_LOCATION)) { @@ -301,9 +290,9 @@ else } // Specific to thirdparty module - if ($element_id && $element == 'societe') + if (($element_id || $element_ref) && $element == 'societe') { - $socstatic = fetchObjectByElement($element_id, $element); + $socstatic = fetchObjectByElement($element_id, $element, $element_ref); if (is_object($socstatic)) { $savobject = $object; @@ -314,7 +303,7 @@ else dol_fiche_head($head, 'resources', $langs->trans("ThirdParty"), 0, 'company'); - dol_banner_tab($socstatic, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom'); + dol_banner_tab($socstatic, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom', '', '&element='.$element); print '
'; @@ -337,12 +326,12 @@ else } // Specific to fichinter module - if ($element_id && $element == 'fichinter') + if (($element_id || $element_ref) && $element == 'fichinter') { require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php'; $fichinter = new Fichinter($db); - $fichinter->fetch($element_id); + $fichinter->fetch($element_id, $element_ref); $fichinter->fetch_thirdparty(); if (is_object($fichinter)) @@ -395,7 +384,7 @@ else } $morehtmlref.='
'; - dol_banner_tab($fichinter, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + dol_banner_tab($fichinter, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '&element='.$element, 0, '', '', 1); dol_fiche_end(); } @@ -403,7 +392,7 @@ else // hook for other elements linked - $parameters=array('element'=>$element, 'element_id'=>$element_id ); + $parameters=array('element'=>$element, 'element_id'=>$element_id, 'element_ref'=>$element_ref); $reshook=$hookmanager->executeHooks('printElementTab',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index c5d9dd13189..ec4ccdd2b38 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -967,12 +967,13 @@ div.attacharea { } div.arearef { - /*border-bottom: 1px solid #bbb;*/ padding-top: 2px; - padding-bottom: 5px; - /*padding-right: 3px; - padding-left: 2px;*/ margin-bottom: 10px; + padding-bottom: 7px; +} +div.arearefnobottom { + padding-top: 2px; + padding-bottom: 4px; } div.heightref { min-height: 80px; @@ -1961,15 +1962,8 @@ div.tabBar { color: #; padding-top: 16px; padding-left: 0px; padding-right: 0px; - /*padding-left: 18px; - padding-right: 18px;*/ padding-bottom: 14px; margin: 0px 0px 14px 0px; - /*-moz-border-radius:4px; - -webkit-border-radius: 4px; - border-radius: 4px; - border-right: 1px solid #AAA; - border-left: 1px solid #AAA; */ border-top: 1px solid #BBB; border-bottom: 1px solid #AAA; width: auto; @@ -2456,11 +2450,16 @@ table.liste tr, table.noborder tr, div.noborder form { table.liste th, table.noborder th, table.noborder tr.liste_titre td, table.noborder tr.box_titre td { padding: 8px 2px 8px 3px; /* t r b l */ } -tr.box_titre .nobordernopadding td { padding: 0px ! important; } -table.liste td, table.noborder td, div.noborder form, div.noborder form div { - padding: 5px 2px 5px 3px; /* t r b l */ +table.liste td, table.noborder td, div.noborder form div { + padding: 8px 2px 8px 3px; /* t r b l */ +} +div.liste_titre_bydiv .divsearchfield { + padding: 2px 1px 2px 0px; /* t r b l */ } +tr.box_titre .nobordernopadding td { + padding: 0px ! important; +} table.nobordernopadding { border-collapse: collapse !important; border: 0px; @@ -2725,7 +2724,7 @@ tr.even td, tr.pair td, tr.odd td, tr.impair td, form.odd div.tagtd, form.impair padding: 5px 2px 5px 3px; border-bottom: 1px solid #ddd; } -tr.even:last-of-type td, tr.pair:last-of-type td, tr.odd:last-of-type td, tr.impair:last-of-type td { +form.tagtr:last-of-type div.tagtd, tr.even:last-of-type td, tr.pair:last-of-type td, tr.odd:last-of-type td, tr.impair:last-of-type td { border-bottom: 0px !important; } tr.even td .nobordernopadding tr td, tr.pair td .nobordernopadding tr td, tr.impair td .nobordernopadding tr td, tr.odd td .nobordernopadding tr td { @@ -2737,26 +2736,18 @@ td.nobottom, td.nobottom { div.liste_titre .tagtd { vertical-align: middle; } -div.liste_titre { +/*div.liste_titre { box-shadow: 2px 2px 4px #CCC; -} +}*/ div.liste_titre { min-height: 26px !important; /* We cant use height because it's a div and it should be higher if content is more. but min-height does not work either for div */ padding-top: 2px; padding-bottom: 2px; - /*border-right-width: 1px; - border-right-color: #BBB; - border-right-style: solid; - - border-left-width: 1px; - border-left-color: #BBB; - border-left-style: solid;*/ - - border-top-width: 1px; +/* border-top-width: 1px; border-top-color: #BBB; - border-top-style: solid; + border-top-style: solid;*/ } div.liste_titre_bydiv { border-top-width: px; @@ -2773,7 +2764,7 @@ tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, tabl { height: 26px !important; } -div.liste_titre, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, table.dataTable thead tr +div.liste_titre_bydiv, .liste_titre div.tagtr, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, table.dataTable thead tr { background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.4) 100%); @@ -2791,11 +2782,11 @@ div.liste_titre, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.list border-bottom: 1px solid #FDFFFF; text-align: ; } -tr.liste_titre th, tr.liste_titre td, th.liste_titre, form.liste_titre div, div.liste_titre +tr.liste_titre th, tr.liste_titre td, th.liste_titre { border-bottom: 1px solid #; } -tr.liste_titre th, th.liste_titre, tr.liste_titre td, td.liste_titre, form.liste_titre div, div.liste_titre +tr.liste_titre th, th.liste_titre, tr.liste_titre td, td.liste_titre, form.liste_titre div { font-family: ; font-weight: ; @@ -2819,7 +2810,7 @@ tr.liste_titre_topborder td { .liste_titre td a.notasortlink:hover { background: transparent; } -tr.liste_titre td.liste_titre { /* For last line of table headers only */ +tr.liste_titre td.liste_titre, form.liste_titre div.tagtd { /* For last line of table headers only */ border-bottom: 1px solid rgb(); } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index fd22ef5520d..17eec130377 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1016,13 +1016,14 @@ div.attacharea { padding-bottom: 10px; } div.arearef { - /*border-bottom: 1px solid #bbb;*/ padding-top: 2px; padding-bottom: 5px; - /*padding-right: 3px; - padding-left: 2px;*/ margin-bottom: 10px; } +div.arearefnobottom { + padding-top: 2px; + padding-bottom: 4px; +} div.heightref { min-height: 80px; } @@ -2379,6 +2380,13 @@ table.noborder td, div.noborder form, div.noborder form div { padding: 4px 2px 4px 3px; /* t r b l */ } +table.liste td, table.noborder td, div.noborder form div { + padding: 8px 2px 8px 3px; /* t r b l */ +} +div.liste_titre_bydiv .divsearchfield { + padding: 2px 1px 2px 0px; /* t r b l */ +} + table.nobordernopadding { border-collapse: collapse !important; border: 0px; From a2133f391fe6da43a1cec40586cf0d9e9045dcc9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Dec 2016 14:52:25 +0100 Subject: [PATCH 24/36] Complete work on dol_banner --- htdocs/comm/propal/note.php | 2 +- htdocs/core/class/conf.class.php | 1 + htdocs/core/lib/agenda.lib.php | 4 +- htdocs/fichinter/list.php | 3 +- htdocs/supplier_proposal/card.php | 11 --- htdocs/supplier_proposal/document.php | 72 ++++++++++++++++---- htdocs/supplier_proposal/info.php | 58 +++++++++++++++- htdocs/supplier_proposal/note.php | 97 +++++++++++++++++---------- htdocs/theme/eldy/style.css.php | 1 + htdocs/theme/md/style.css.php | 1 + 10 files changed, 183 insertions(+), 67 deletions(-) diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index d161fe03870..57181b83f6b 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -132,9 +132,9 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; + $cssclass="titlefield"; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; - print '
'; print ''; dol_fiche_end(); diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index c451b2e32fd..81de34e012f 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -282,6 +282,7 @@ class Conf // Define default dir_output and dir_temp for directories of modules foreach($this->modules as $module) { + //var_dump($module); // For multicompany sharings $this->$module->multidir_output = array($this->entity => $rootfordata."/".$module); $this->$module->multidir_temp = array($this->entity => $rootfordata."/".$module."/temp"); diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index ad592359936..09f89ba0c3f 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -239,7 +239,7 @@ function show_array_actions_to_do($max=5) print '
'.$langs->trans("Status").' / '.$langs->trans("Percentage").''; - print $act->getLibStatut(4); - print '
'; print ''; - print ''; $var = true; @@ -336,7 +336,7 @@ function show_array_last_actions_done($max=5) print '
'.$langs->trans("LastActionsToDo",$max).''.$langs->trans("FullList").''; + print ''.$langs->trans("FullList").''; print '
'; print ''; - print ''; $var = true; $i = 0; diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 5126768c083..9d01643825a 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -407,10 +407,11 @@ if ($result) print $warnornote; print ''; } + // Other picto tool print '
'.$langs->trans("LastDoneTasks",$max).''.$langs->trans("FullList").''; + print ''.$langs->trans("FullList").''; print '
'; $filename=dol_sanitizeFileName($obj->ref); - $filedir=$conf->fichinter->dir_output . '/' . dol_sanitizeFileName($obj->ref); + $filedir=$conf->ficheinter->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); print '
'; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 443e402674f..d91823dfcf4 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1408,17 +1408,6 @@ if ($action == 'create') print ''; - // Ref - /* - print ''; - - // Company - print ''; - print ''; - */ - // Payment term print '
' . $langs->trans('Ref') . ''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); - print '
' . $langs->trans('Supplier') . '' . $soc->getNomUrl(1) . '
'; print ''; + $filterfound=0; foreach ($fieldlist as $field => $value) { $showfield=1; // By defaut @@ -1284,21 +1285,25 @@ if ($id) { if ($value == 'country') { - print ''; + $filterfound++; } else { - print ''; + print ''; } } } if ($id == 4) print ''; - print ''; + print ''; print ''; print ''; @@ -1314,19 +1319,17 @@ if ($id) print ''; if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code))) { - print ''; - print ''; - print ''; - print ''; - $tmpaction='edit'; $parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error=$hookmanager->error; $errors=$hookmanager->errors; + // Show fields if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit'); print ''; diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 9545332d93b..faf6f28c955 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -251,11 +251,16 @@ $dolibarr_main_restrict_os_commands='mysqldump, mysql, pg_dump, pgrestore'; $dolibarr_nocsrfcheck='0'; // dolibarr_mailing_limit_sendbyweb -// Can set a limit for mailing send by web. Can be used for a restricted mode. -// Default value: 0 (use database value if exist) -// Examples: -// $dolibarr_mailing_limit_sendbyweb='0'; +// Can set a limit for mailing send by web. This overwrite database value. Can be used to restrict on OS level. +// Default value: '25' +// Examples: '-1' (sending by web is forbidden) +// $dolibarr_mailing_limit_sendbyweb='25'; +// dolibarr_mailing_limit_sendbycli +// Can set a limit for mailing send by cli. This overwrite database value. Can be used to restrict on OS level. +// Default value: '0' (no hard limit, use soft database value if exists) +// Examples: '-1' (sending by cli is forbidden) +// $dolibarr_mailing_limit_sendbycli='0'; //################## @@ -274,18 +279,6 @@ $dolibarr_nocsrfcheck='0'; // Examples: // $dolibarr_main_limit_users='0'; -// dolibarr_mailing_limit_sendbyweb -// Can set a limit for mailing send by web. This overwrite database value. Can be used to restrict on OS level. -// Default value: '0' (no overwrite, use database value if exists) -// Examples: '-1' (sending by web is forbidden) -// $dolibarr_mailing_limit_sendbyweb='0'; - -// dolibarr_mailing_limit_sendbycli -// Can set a limit for mailing send by cli. This overwrite database value. Can be used to restrict on OS level. -// Default value: '0' (no overwrite, use database value if exists) -// Examples: '-1' (sending by cli is forbidden) -// $dolibarr_mailing_limit_sendbycli='0'; - // dolibarr_strict_mode // Set this to 1 to enable the PHP strict mode. For dev environment only. // Default value: 0 (use database value if exist) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index e74ba8fc03b..52cce35f0d2 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -483,28 +483,35 @@ class CMailFile // Check number of recipient is lower or equal than MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL=10; - $tmparray = explode(',', $this->addr_to); - if (count($tmparray) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL) + $tmparray1 = explode(',', $this->addr_to); + if (count($tmparray1) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL) { $this->error = 'Too much recipients in to:'; dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); return false; } - $tmparray = explode(',', $this->addr_cc); - if (count($tmparray) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL) + $tmparray2 = explode(',', $this->addr_cc); + if (count($tmparray2) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL) { $this->error = 'Too much recipients in cc:'; dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); return false; } - $tmparray = explode(',', $this->addr_bcc); - if (count($tmparray) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL) + $tmparray3 = explode(',', $this->addr_bcc); + if (count($tmparray3) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL) { $this->error = 'Too much recipients in bcc:'; dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); return false; } - + if ((count($tmparray1)+count($tmparray2)+count($tmparray3)) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL) + { + $this->error = 'Too much recipients in to:, cc:, bcc:'; + dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); + return false; + } + + // Action according to choosed sending method if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') { diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index ccbc8aa9b92..eddcf1ebbdf 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); -if (! defined('DOL_VERSION')) define('DOL_VERSION','4.0.3'); +if (! defined('DOL_VERSION')) define('DOL_VERSION','4.0.4'); if (! defined('EURO')) define('EURO',chr(128)); From 635157be4c3075fd8cdf902a4ac2fca3178ed34d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Dec 2016 12:36:30 +0100 Subject: [PATCH 35/36] Fix bad translation --- htdocs/langs/eu_ES/mails.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/eu_ES/mails.lang b/htdocs/langs/eu_ES/mails.lang index d6224bf2346..c9116999a8f 100644 --- a/htdocs/langs/eu_ES/mails.lang +++ b/htdocs/langs/eu_ES/mails.lang @@ -27,7 +27,7 @@ DeleteAMailing=Delete an emailing PreviewMailing=Preview emailing CreateMailing=Create emailing TestMailing=Test email -ValidMailing=Valid emailing +ValidMailing=Validate emailing MailingStatusDraft=Draft MailingStatusValidated=Validated MailingStatusSent=Sent From b9e362833f7395e50173f5dd8f434f1a25bb8f93 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Dec 2016 13:15:14 +0100 Subject: [PATCH 36/36] More complete label --- htdocs/install/mysql/data/llx_c_typent.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_typent.sql b/htdocs/install/mysql/data/llx_c_typent.sql index 11b512f26c2..4365a2e99a6 100644 --- a/htdocs/install/mysql/data/llx_c_typent.sql +++ b/htdocs/install/mysql/data/llx_c_typent.sql @@ -43,6 +43,6 @@ insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 7, 'TE_RE insert into llx_c_typent (id,code,libelle,fk_country,active) values ( 8, 'TE_PRIVATE', 'Particulier', NULL, 1); insert into llx_c_typent (id,code,libelle,fk_country,active) values (100, 'TE_OTHER', 'Autres', NULL, 1); -- Argentina (country 23) -insert into llx_c_typent (id,code,libelle,fk_country,active) values (231, 'TE_A_RI', 'Responsable Inscripto', 23, 0); -insert into llx_c_typent (id,code,libelle,fk_country,active) values (232, 'TE_B_RNI', 'Responsable No Inscripto', 23, 0); -insert into llx_c_typent (id,code,libelle,fk_country,active) values (233, 'TE_C_FE', 'Consumidor Final/Exento', 23, 0); +insert into llx_c_typent (id,code,libelle,fk_country,active) values (231, 'TE_A_RI', 'Responsable Inscripto (typo A)', 23, 0); +insert into llx_c_typent (id,code,libelle,fk_country,active) values (232, 'TE_B_RNI', 'Responsable No Inscripto (typo B)', 23, 0); +insert into llx_c_typent (id,code,libelle,fk_country,active) values (233, 'TE_C_FE', 'Consumidor Final/Exento (typo C)', 23, 0);
'; diff --git a/htdocs/supplier_proposal/document.php b/htdocs/supplier_proposal/document.php index d8c51a45152..2f49951c844 100644 --- a/htdocs/supplier_proposal/document.php +++ b/htdocs/supplier_proposal/document.php @@ -93,26 +93,70 @@ if ($object->id > 0) $totalsize+=$file['size']; } + + // Supplier proposal card + $linkback = '' . $langs->trans("BackToList") . ''; + + + $morehtmlref='
'; + // Ref supplier + //$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1); + //$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->supplier_proposal->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print ''; - $linkback=''.$langs->trans("BackToList").''; - - // Ref - print ''; - - // Supplier - print ""; - print ''; - - print ''; - print ''; + print ''; + print ''; print '
'.$langs->trans('Ref').''; - print $form->showrefnav($object,'ref',$linkback,1,'ref','ref',''); - print '
".$langs->trans("Supplier")."'.$object->thirdparty->getNomUrl(1).'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; print '
'; - + + dol_fiche_end(); + $modulepart = 'supplier_proposal'; $permission = $user->rights->supplier_proposal->creer; $permtoedit = $user->rights->supplier_proposal->creer; diff --git a/htdocs/supplier_proposal/info.php b/htdocs/supplier_proposal/info.php index 9c3f8967bd5..de98ed5be65 100644 --- a/htdocs/supplier_proposal/info.php +++ b/htdocs/supplier_proposal/info.php @@ -49,10 +49,65 @@ $object = new SupplierProposal($db); $object->fetch($id); $object->fetch_thirdparty(); +$object->info($object->id); + + $head = supplier_proposal_prepare_head($object); dol_fiche_head($head, 'info', $langs->trans('CommRequest'), 0, 'supplier_proposal'); -$object->info($object->id); +// Supplier proposal card +$linkback = '' . $langs->trans("BackToList") . ''; + + +$morehtmlref='
'; +// Ref supplier +//$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1); +//$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', null, null, '', 1); +// Thirdparty +$morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); +// Project +if (! empty($conf->projet->enabled)) +{ + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->supplier_proposal->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } +} +$morehtmlref.='
'; + + +dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + +print '
'; +print '
'; + +print '
'; print '
'; dol_print_object_info($object); @@ -60,6 +115,7 @@ print '
'; print '
'; +dol_fiche_end(); llxFooter(); $db->close(); diff --git a/htdocs/supplier_proposal/note.php b/htdocs/supplier_proposal/note.php index 981b654599d..b764372848d 100644 --- a/htdocs/supplier_proposal/note.php +++ b/htdocs/supplier_proposal/note.php @@ -45,19 +45,18 @@ $object = new SupplierProposal($db); -/******************************************************************************/ -/* Actions */ -/******************************************************************************/ +/* + * Actions + */ $permissionnote=$user->rights->supplier_proposal->creer; // Used by the include of actions_setnotes.inc.php include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once - -/******************************************************************************/ -/* Affichage fiche */ -/******************************************************************************/ +/* + * View + */ llxHeader('',$langs->trans('CommRequest'),'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur'); @@ -71,47 +70,71 @@ if ($id > 0 || ! empty($ref)) if ($object->fetch($id, $ref)) { + $object->fetch_thirdparty(); + $societe = new Societe($db); if ( $societe->fetch($object->socid) ) { $head = supplier_proposal_prepare_head($object); dol_fiche_head($head, 'note', $langs->trans('CommRequest'), 0, 'supplier_proposal'); - print ''; - $linkback = ''.$langs->trans('BackToList').''; - - // Ref - print ''; + // Supplier proposal card + $linkback = '' . $langs->trans("BackToList") . ''; - // Customer - if ( is_null($object->thirdparty) ) - $object->fetch_thirdparty(); - print ""; - print ''; - // Payment term - print ''; - print ''; - print ''; - print ''; + $morehtmlref='
'; + // Ref supplier + //$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1); + //$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->supplier_proposal->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; - print "
'.$langs->trans('Ref').''; - print $form->showrefnav($object,'ref',$linkback,1,'ref','ref',''); - print '
".$langs->trans("Supplier")."'.$object->thirdparty->getNomUrl(1).'
'; - print ''; - print '
'; - print $langs->trans('PaymentConditionsShort'); - print '
'; - print '
'; - $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->cond_reglement_id, 'none', 1); - print '
'.$langs->trans('SupplierProposalDate').''; - print dol_print_date($object->date_livraison,'daytext'); - print '
"; - - print '
'; - + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + + $cssclass="titlefield"; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; + + print '
'; dol_fiche_end(); } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index ec4ccdd2b38..0e278019df6 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -254,6 +254,7 @@ a.tab { font-weight: bold !important; } a:link, a:visited, a:hover, a:active { font-family: ; font-weight: normal; color: rgb(); text-decoration: none; } a:hover { text-decoration: underline; color: rgb(); } +a.commonlink { color: rgb() !important; text-decoration: none; } input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { background-color: #FFF; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 17eec130377..f45b0355880 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -254,6 +254,7 @@ a.tab { font-weight: bold !important; } a:link, a:visited, a:hover, a:active { font-family: ; font-weight: normal; color: rgb(); text-decoration: none; } a:hover { text-decoration: underline; color: rgb(); } +a.commonlink { color: rgb() !important; text-decoration: none; } input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { background-color: #FDFDFD; From 24cad7cfdf191f87a70f6121867897102f2b6c3f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Dec 2016 14:57:00 +0100 Subject: [PATCH 25/36] Fix return code REST similar for all api with POST --- test/phpunit/RestAPIUserTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/phpunit/RestAPIUserTest.php b/test/phpunit/RestAPIUserTest.php index a92bc80ed63..a79739fef43 100644 --- a/test/phpunit/RestAPIUserTest.php +++ b/test/phpunit/RestAPIUserTest.php @@ -207,9 +207,9 @@ class RestAPIUserTest extends PHPUnit_Framework_TestCase print __METHOD__." Result code for creating user ".var_export($result, true)."\n"; print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; $this->assertEquals($result['curl_error_no'],''); - $object=json_decode($result['content'], true); - $this->assertNotNull($object, "Parsing of json result must no be null"); - $this->assertGreaterThan(0, $object['id'], $object['error']['code'].' '.$object['error']['message']); + $resid=json_decode($result['content'], true); + $this->assertNotNull($resid, "Parsing of json result must no be null"); + $this->assertGreaterThan(0, $resid, $object['error']['code'].' '.$object['error']['message']); // attempt to create duplicated user print __METHOD__." Request POST url=".$url."\n"; From cb4e0233b9ca51cc0b629d2f6be8c06b2c7e6f27 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Dec 2016 15:21:38 +0100 Subject: [PATCH 26/36] Fix orphelins --- htdocs/install/mysql/migration/repair.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 9f192a0d9cc..1dda63f61e7 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -143,6 +143,10 @@ delete from llx_element_element where sourcetype='facture' and fk_source not in delete from llx_element_element where sourcetype='commande' and fk_source not in (select rowid from llx_commande); +-- Fix: delete orphelin actioncomm_resources +delete from llx_actioncomm_resources where fk_actioncomm not in (select id from llx_actioncomm); + + UPDATE llx_product SET canvas = NULL where canvas = 'default@product'; UPDATE llx_product SET canvas = NULL where canvas = 'service@product'; From 46a804114345d252c033a712a4ea034273122092 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Dec 2016 15:22:25 +0100 Subject: [PATCH 27/36] Clean orphelins --- htdocs/install/mysql/migration/4.0.0-5.0.0.sql | 1 + htdocs/install/mysql/migration/repair.sql | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) 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 b94d289de31..974184b5f58 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 @@ -230,6 +230,7 @@ ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_valid (fk_user ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_approve (fk_user_approve); ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_refuse (fk_user_approve); +DELETE FROM llx_actioncomm_resources WHERE fk_actioncomm not in (select id from llx_actioncomm); -- Sequence to removed duplicated values of llx_links. Use serveral times if you still have duplicate. drop table tmp_links_double; diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 1dda63f61e7..8d6c12b407f 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -144,7 +144,7 @@ delete from llx_element_element where sourcetype='commande' and fk_source not in -- Fix: delete orphelin actioncomm_resources -delete from llx_actioncomm_resources where fk_actioncomm not in (select id from llx_actioncomm); +DELETE FROM llx_actioncomm_resources WHERE fk_actioncomm not in (select id from llx_actioncomm); UPDATE llx_product SET canvas = NULL where canvas = 'default@product'; From 8ce5ed01923dd105782a1a755a847d03c81d6775 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Dec 2016 15:57:31 +0100 Subject: [PATCH 28/36] Fix position of discount on PDF with US letter format --- .../commande/doc/pdf_einstein.modules.php | 1 + .../modules/facture/doc/pdf_crabe.modules.php | 18 ++++++++++-------- .../modules/propale/doc/pdf_azur.modules.php | 1 + .../pdf/pdf_canelle.modules.php | 1 + .../pdf/pdf_muscadet.modules.php | 1 + .../doc/pdf_aurore.modules.php | 1 + 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index e753c12e2ea..95c8f933be5 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -129,6 +129,7 @@ class pdf_einstein extends ModelePDFCommandes $this->posxtva-=20; $this->posxup-=20; $this->posxqty-=20; + $this->posxunit-=20; $this->posxdiscount-=20; $this->postotalht-=20; } diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index cc0d6478bb6..f127ab09500 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -135,12 +135,14 @@ class pdf_crabe extends ModelePDFFactures $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images if ($this->page_largeur < 210) // To work with US executive format { - $this->posxpicture-=20; - $this->posxtva-=20; - $this->posxup-=20; - $this->posxqty-=20; - $this->posxdiscount-=20; - $this->postotalht-=20; + $this->posxpicture-=20; + $this->posxtva-=20; + $this->posxup-=20; + $this->posxqty-=20; + $this->posxunit-=20; + $this->posxdiscount-=20; + $this->posxprogress-=20; + $this->postotalht-=20; } $this->tva=array(); @@ -297,7 +299,7 @@ class pdf_crabe extends ModelePDFFactures $this->atleastonediscount++; } } - if (empty($this->atleastonediscount) && empty($conf->global->PRODUCT_USE_UNITS)) + if (empty($this->atleastonediscount) && empty($conf->global->PRODUCT_USE_UNITS)) // retreive space not used by discount { $this->posxpicture+=($this->postotalht - $this->posxdiscount); $this->posxtva+=($this->postotalht - $this->posxdiscount); @@ -527,9 +529,9 @@ class pdf_crabe extends ModelePDFFactures $pdf->MultiCell($this->posxprogress-$this->posxdiscount+2, 3, $remise_percent, 0, 'R'); } + // Situation progress if ($this->situationinvoice) { - // Situation progress $progress = pdf_getlineprogress($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->posxprogress, $curY); $pdf->MultiCell($this->postotalht-$this->posxprogress, 3, $progress, 0, 'R'); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index ee977908814..d599cb2e58a 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -127,6 +127,7 @@ class pdf_azur extends ModelePDFPropales $this->posxtva-=20; $this->posxup-=20; $this->posxqty-=20; + $this->posxunit-=20; $this->posxdiscount-=20; $this->postotalht-=20; } diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index cd6f0b1fdc9..b476a2b9986 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -113,6 +113,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $this->posxtva-=20; $this->posxup-=20; $this->posxqty-=20; + $this->posxunit-=20; $this->posxdiscount-=20; $this->postotalht-=20; } diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index dc40d084d71..a23501497a5 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -127,6 +127,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $this->posxtva-=20; $this->posxup-=20; $this->posxqty-=20; + $this->posxunit-=20; $this->posxdiscount-=20; $this->postotalht-=20; } diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index e53f0343230..bc78730ba57 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -115,6 +115,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $this->posxtva-=20; $this->posxup-=20; $this->posxqty-=20; + $this->posxunit-=20; $this->posxdiscount-=20; $this->postotalht-=20; } From 7e2b41402ee3f192cd40a74eba84501c8f03165c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Dec 2016 16:24:07 +0100 Subject: [PATCH 29/36] Fix bad balance of form --- htdocs/admin/dict.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 0cd4886f8c9..2ca1337736e 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1274,6 +1274,7 @@ if ($id) // Title line with search boxes print '
'; + print ''; print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone'); print ''; - $searchpitco=$form->showFilterAndCheckAddButtons(0); - print $searchpitco; + if ($filterfound) + { + $searchpitco=$form->showFilterAndCheckAddButtons(0); + print $searchpitco; + } print '
'; + print ''; + print ''; print ''; print '
'; print ''; From b2fbef4a919e60d759bf372fb99682cb3a0f2b29 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 25 Dec 2016 23:04:59 +0100 Subject: [PATCH 30/36] Prepare 4.0.3 --- ChangeLog | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/ChangeLog b/ChangeLog index c602d3a2a3c..00d654010c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,52 @@ Upgrading to any other version or any other database system is abolutely require make a Dolibarr upgrade. +***** ChangeLog for 4.0.3 to 4.0.2 ***** +FIX: #5853 $conf->global->$calc==0 || $conf->global->$calc==1 +FIX: #5958 no discount on supplier command made by replenishment +FIX: #5966 Bug: getNomUrl tooltips show Proposal info even if user has no rights to read them +FIX: #5972 #5734 +FIX: #6007 +FIX: #6010 +FIX: #6029 +FIX: #6043 - Payment mode not visible on supplier invoice list +FIX: #6051 +FIX: #6062 +FIX: #6088 +FIX: A draft can be deleted by a user with create permission. +FIX: bad permission to see contract on home page +FIX: bad permission to see contract statistics +FIX: Bcc must not appears to recipient when using SMTPs lib +FIX: Consistent description for add or edit product +FIX: delete contract extrafields on contract deletion +FIX: Deposits and credit notes weren't added in the received and pending columns +FIX: export extrafields must not include separe type +FIX: Export of opportunity status must be code, not id. +FIX: False positive on services not activated +FIX: Filter was wrong or lost during navigation +FIX: HT and TTC price should always be displayed together +FIX: if a supplier price reference is changed after creating an order, we can't clone order. +FIX: in export. Error when using a separate extrafields. +FIX: Introduce hidden option MAIL_PREFIX_FOR_EMAIL_ID to solve pb of tracking email. +FIX: javascript error when using on mobile/smartphone +FIX: javascript xss injection and a translation +FIX: Label of project is in field title not label. +FIX: List of people able to validate an expense report was not complete. +FIX: Missing field +FIX: Module gravatar was not triggered on thirdparty and contact card +FIX: Must use external link into a forged email content. +FIX: Pb in management of date end of projects +FIX: Regression when deleting product +FIX: rendering of output of estimated amount on project overview page. +FIX: Sanitize title of ajax_dialog +FIX: Security to restrict email sending was not efficient +FIX: Setting supplier as client when accept a supplier proposal +FIX: Some statistics not compatible with multicompany module. +FIX: the time spent on project was not visible in its overwiew +FIX: Update intervention lline crash with PgSQL +FIX: wrong test on dict.php +FIX: wrong var name + ***** ChangeLog for 4.0.2 compared to 4.0.1 ***** FIX: #5340 FIX: #5779 From c16489a3c04d6f0e06b360924c5acacebfd4f6c9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Dec 2016 19:54:06 +0100 Subject: [PATCH 31/36] Fix add message to explain why some emails fails --- htdocs/admin/mails.php | 6 ++++++ htdocs/langs/en_US/admin.lang | 1 + 2 files changed, 7 insertions(+) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index d05518374c1..ed290060370 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -619,6 +619,12 @@ else print ''; + if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') + { + $text = $langs->trans("WarningPHPMail"); + print info_admin($text); + } + // Run the test to connect if ($action == 'testconnect') { diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 82ff69fe88a..c57ea45858a 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -411,6 +411,7 @@ ModuleCompanyCodePanicum=Return an empty accountancy code. ModuleCompanyCodeDigitaria=Accountancy code depends on third party code. The code is composed of the character "C" in the first position followed by the first 5 characters of the third party code. Use3StepsApproval=By default, Purchase Orders need to be created and approved by 2 different users (one step/user to create and one step/user to approve. Note that if user has both permission to create and approve, one step/user will be enough). You can ask with this option to introduce a third step/user approval, if amount is higher than a dedicated value (so 3 steps will be necessary: 1=validation, 2=first approval and 3=second approval if amount is enough).
Set this to empty if one approval (2 steps) is enough, set it to a very low value (0.1) if a second approval (3 steps) is always required. UseDoubleApproval=Use a 3 steps approval when amount (without tax) is higher than... +WarningPHPMail=WARNING: Some email providers (like Yahoo) does not allow you to send an email from another server than the Yahoo server if the email address used as a sender is your Yahoo email (like myemail@yahoo.com, myemail@yahoo.fr, ...). Your current setup use the server of the application to send email, so some recipients (the one compatible with the restrictive DMARC protocol), will ask Yahoo if they can accept your email and Yahoo will respond "no" because the server is not a server owned by Yahoo, so few of your sent Emails may not be accepted.
If your Email provider (like Yahoo) has this restriction, you must change Email setup to choose the other method "SMTP server" and enter the SMTP server and credentials provided by your Email provider (ask your EMail provider to get SMTP credentials for your account). # Modules Module0Name=Users & groups From 45028de51f1f693c0dcab01a7b5846f3c43409f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 25 Dec 2016 23:47:25 +0100 Subject: [PATCH 32/36] Better fix for install on distant server --- htdocs/install/step1.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index 7f9c1a2fc4b..b323c970a9d 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -541,16 +541,20 @@ if (! $error && $db->connected && $action == "set") { if ($db->connected) { + $resultbis = 1; + // Create user - $tmpdolibarr_main_db_host = $dolibarr_main_db_host; + $result=$db->DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name); + // Create user bis if ($databasefortest == 'mysql') { - if (! in_array($conf->db->host, array('127.0.0.1', 'localhost', 'localhost.local'))) $tmpdolibarr_main_db_host='%'; + if (! in_array($dolibarr_main_db_host, array('127.0.0.1', '::1', 'localhost', 'localhost.local'))) + { + $resultbis=$db->DDLCreateUser('%', $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name); + } } - $result=$db->DDLCreateUser($tmpdolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name); - - if ($result > 0) + if ($result > 0 && $resultbis > 0) { print '
'; From c9c8079c3d293ee139a0a2cadac6bac520133548 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Dec 2016 00:00:28 +0100 Subject: [PATCH 33/36] Can add additionnal paramon mail to solve rare sendmail problems --- htdocs/core/class/CMailFile.class.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 027bedebb6e..4ba153ad5da 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -538,25 +538,28 @@ class CMailFile } else { - $bounce = ''; // By default + $additionnalparam = ''; // By default if (! empty($conf->global->MAIN_MAIL_ALLOW_SENDMAIL_F)) { // le "Return-Path" (retour des messages bounced) dans les header ne fonctionne pas avec tous les MTA // Le forcage de la valeur grace à l'option -f de sendmail est donc possible si la constante MAIN_MAIL_ALLOW_SENDMAIL_F est definie. - // La variable definie pose des pb avec certains sendmail securisee (option -f refusee car dangereuse) - $bounce .= ($bounce?' ':'').(! empty($conf->global->MAIN_MAIL_ERRORS_TO) ? '-f' . $this->getValidAddress($conf->global->MAIN_MAIL_ERRORS_TO,2) : ($this->addr_from != '' ? '-f' . $this->getValidAddress($this->addr_from,2) : '') ); + // Having this variable defined may create problems with some sendmail (option -f refused) + // Having this variable not defined may create problems with some other sendmail (option -f required) + $additionnalparam .= ($additionnalparam?' ':'').(! empty($conf->global->MAIN_MAIL_ERRORS_TO) ? '-f' . $this->getValidAddress($conf->global->MAIN_MAIL_ERRORS_TO,2) : ($this->addr_from != '' ? '-f' . $this->getValidAddress($this->addr_from,2) : '') ); } if (! empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_BA)) // To force usage of -ba option. This option tells sendmail to read From: or Sender: to setup sender { - $bounce .= ($bounce?' ':'').'-ba'; + $additionnalparam .= ($additionnalparam?' ':'').'-ba'; } - dol_syslog("CMailFile::sendfile: mail start HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port').", additionnal_parameters=".$bounce, LOG_DEBUG); + if (! empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_ADDPARAM)) $additionnalparam .= ($additionnalparam?' ':'').'-U '.$additionnalparam; // Use -U to add additionnal params + + dol_syslog("CMailFile::sendfile: mail start HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port').", additionnal_parameters=".$additionnalparam, LOG_DEBUG); $this->message=stripslashes($this->message); if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail(); - if (! empty($bounce)) $res = mail($dest,$this->encodetorfc2822($this->subject),$this->message,$this->headers, $bounce); + if (! empty($additionnalparam)) $res = mail($dest, $this->encodetorfc2822($this->subject), $this->message, $this->headers, $additionnalparam); else $res = mail($dest, $this->encodetorfc2822($this->subject), $this->message, $this->headers); if (! $res) From e297b647220b4d80cd8159cf1fa9e6e59b314ac2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Dec 2016 12:30:59 +0100 Subject: [PATCH 34/36] Several security fix in using mailings. --- htdocs/comm/mailing/card.php | 44 +++++++++++++++------------ htdocs/conf/conf.php.example | 25 ++++++--------- htdocs/core/class/CMailFile.class.php | 21 ++++++++----- htdocs/filefunc.inc.php | 2 +- 4 files changed, 49 insertions(+), 43 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 48044928ecc..3660b560f78 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -753,8 +753,9 @@ else $sendingmode=$conf->global->MAIN_MAIL_SENDMODE; if (empty($sendingmode)) $sendingmode='mail'; // If not defined, we use php mail function - // MAILING_NO_USING_PHPMAIL may be defined or not - // MAILING_LIMIT_SENDBYWEB is always defined to something != 0, MAILING_LIMIT_SENDBYCLI may be defined ot not. + // MAILING_NO_USING_PHPMAIL may be defined or not. + // MAILING_LIMIT_SENDBYWEB is always defined to something != 0 (-1=forbidden). + // MAILING_LIMIT_SENDBYCLI may be defined ot not (-1=forbidden, 0=no limit). if (! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') { // EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent. @@ -794,7 +795,7 @@ else } $text.=$langs->trans('ConfirmSendingEmailing').'
'; $text.=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB); - print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('SendMailing'),$text,'sendallconfirmed',$formquestion,'',1,270); + print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('SendMailing'),$text,'sendallconfirmed',$formquestion,'',1,300); } } @@ -832,23 +833,28 @@ else print $langs->trans("TotalNbOfDistinctRecipients"); print '
'; $nbemail = ($object->nbemail?$object->nbemail:img_warning('').' '.$langs->trans("NoTargetYet").''); - if ($object->statut != 3 && !empty($conf->global->MAILING_LIMIT_SENDBYWEB) && is_numeric($nbemail) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) + if ($object->statut != 3 && is_numeric($nbemail)) { - if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0) - { - $text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB); - print $form->textwithpicto($nbemail,$text,1,'warning'); - } - else - { - $text=$langs->trans('NotEnoughPermissions'); - print $form->textwithpicto($nbemail,$text,1,'warning'); - } - - } - else - { - print $nbemail; + $text=''; + if (! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) + { + if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0) + { + $text.=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB); + } + else + { + $text.=$langs->trans('NotEnoughPermissions'); + } + } + if ($text) + { + print $form->textwithpicto($nbemail,$text,1,'warning'); + } + else + { + print $nbemail; + } } print '