diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index 4d33723a947..72b7c8fe549 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -453,8 +453,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$ok=1;
foreach ($listfield as $f => $value)
{
+ if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory
if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory
- if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryRegion','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
if ($value == 'color' && empty($_POST['color'])) continue;
@@ -1361,14 +1361,18 @@ function fieldList($fieldlist,$obj='',$tabname='')
continue;
} // For state page, we do not show the country input (we link to region, not country)
print '
';
+ if (! in_array('country',$fieldlist)) // If there is already a field country, we don't show country_id (avoid duplicate)
+ {
+ $country_id = (! empty($obj->$fieldlist[$field]) ? $obj->$fieldlist[$field] : 0);
+ print '
';
diff --git a/htdocs/admin/salaries.php b/htdocs/admin/salaries.php
index d7027d8a1dd..99651a4f4f3 100644
--- a/htdocs/admin/salaries.php
+++ b/htdocs/admin/salaries.php
@@ -23,7 +23,7 @@
*/
require '../main.inc.php';
-
+
// Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
@@ -45,7 +45,7 @@ $list = array (
/*
* Actions
*/
-
+
if ($action == 'update')
{
$error = 0;
@@ -72,12 +72,12 @@ if ($action == 'update')
* View
*/
-llxHeader();
+llxHeader('',$langs->trans('SalariesSetup'));
$form = new Form($db);
$linkback=''.$langs->trans("BackToModuleList").'';
-print_fiche_titre($langs->trans('ConfigSalaries'),$linkback,'setup');
+print_fiche_titre($langs->trans('SalariesSetup'),$linkback,'setup');
print '';
-
+
$db->free($result);
}
else
@@ -186,6 +185,6 @@ else
}
-$db->close();
-
llxFooter();
+
+$db->close();
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 98bee3e052c..87ee2f1a1d2 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -601,18 +601,22 @@ abstract class CommonObject
/**
* Load the third party of object, from id $this->socid or $this->fk_soc, into this->thirdparty
*
- * @return int <0 if KO, >0 if OK
+ * @param int $force_thirdparty_id Force thirdparty id
+ * @return int <0 if KO, >0 if OK
*/
- function fetch_thirdparty()
+ function fetch_thirdparty($force_thirdparty_id=0)
{
global $conf;
- if (empty($this->socid) && empty($this->fk_soc) && empty($this->fk_thirdparty)) return 0;
+ if (empty($this->socid) && empty($this->fk_soc) && empty($this->fk_thirdparty) && empty($force_thirdparty_id)) return 0;
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
+ $idtofetch=isset($this->socid)?$this->socid:(isset($this->fk_soc)?$this->fk_soc:$this->fk_thirdparty);
+ if ($force_thirdparty_id) $idtofetch=$force_thirdparty_id;
+
$thirdparty = new Societe($this->db);
- $result=$thirdparty->fetch(isset($this->socid)?$this->socid:(isset($this->fk_soc)?$this->fk_soc:$this->fk_thirdparty));
+ $result=$thirdparty->fetch($idtofetch);
$this->client = $thirdparty; // deprecated
$this->thirdparty = $thirdparty;
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index a4396624f86..30c97e9f1ef 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -510,17 +510,6 @@ class ExtraFields
}
- /**
- * Load array of labels
- *
- * @return void
- */
- function fetch_optionals()
- {
- $this->fetch_name_optionals_label();
- }
-
-
/**
* Load array this->attribute_xxx like attribute_label, attribute_type, ...
*
@@ -528,7 +517,7 @@ class ExtraFields
* @param boolean $forceload Force load of extra fields whatever is option MAIN_EXTRAFIELDS_DISABLED
* @return array Array of attributes for all extra fields
*/
- function fetch_name_optionals_label($elementtype='adherent',$forceload=false)
+ function fetch_name_optionals_label($elementtype,$forceload=false)
{
global $conf;
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index ba597dd4d57..a4d491683b5 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -3096,13 +3096,14 @@ class Form
/**
* Show a form to select a project
*
- * @param int $page Page
- * @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
- * @param int $selected Id pre-selected project
- * @param string $htmlname Name of select field
+ * @param int $page Page
+ * @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
+ * @param int $selected Id pre-selected project
+ * @param string $htmlname Name of select field
+ * @param int $discard_closed Hide all closed projects
* @return void
*/
- function form_project($page, $socid, $selected='', $htmlname='projectid')
+ function form_project($page, $socid, $selected='', $htmlname='projectid', $discard_closed=0)
{
global $langs;
@@ -3119,8 +3120,7 @@ class Form
print '';
print '