diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 0bbdf9eefdf..bd2d7782cef 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -61,6 +61,8 @@ if ($action == 'update') dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", $_POST["MAIN_PROFID2_IN_ADDRESS"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", $_POST["MAIN_PROFID3_IN_ADDRESS"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", $_POST["MAIN_PROFID4_IN_ADDRESS"], 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PROFID5_IN_ADDRESS", $_POST["MAIN_PROFID5_IN_ADDRESS"], 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_PROFID6_IN_ADDRESS", $_POST["MAIN_PROFID6_IN_ADDRESS"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", $_POST["MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", $_POST["MAIN_TVAINTRA_NOT_IN_ADDRESS"], 'chaine', 0, '', $conf->entity); @@ -177,76 +179,25 @@ if ($action == 'edit') // Edit print $form->selectyesno('MAIN_TVAINTRA_NOT_IN_ADDRESS', (! empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS))?$conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS:0, 1); print ''; - // Show prof id 1 in address into pdf - - if (! $noCountryCode) + // Show prof id in address into pdf + for($i=1; $i<=6; $i++) { - $pid1=$langs->transcountry("ProfId1", $mysoc->country_code); - if ($pid1 == '-') $pid1=false; - } - else - { - $pid1 = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid1) - { - print ''.$langs->trans("ShowProfIdInAddress").' - '.$pid1.''; - print $form->selectyesno('MAIN_PROFID1_IN_ADDRESS', isset($conf->global->MAIN_PROFID1_IN_ADDRESS)?$conf->global->MAIN_PROFID1_IN_ADDRESS:0, 1, $noCountryCode); - print ''; - } - - // Show prof id 2 in address into pdf - - if (! $noCountryCode) - { - $pid2=$langs->transcountry("ProfId2", $mysoc->country_code); - if ($pid2 == '-') $pid2=false; - } - else - { - $pid2 = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid2) - { - print ''.$langs->trans("ShowProfIdInAddress").' - '.$pid2.''; - print $form->selectyesno('MAIN_PROFID2_IN_ADDRESS', isset($conf->global->MAIN_PROFID2_IN_ADDRESS)?$conf->global->MAIN_PROFID2_IN_ADDRESS:0, 1, $noCountryCode); - print ''; - } - - // Show prof id 3 in address into pdf - - if (! $noCountryCode) - { - $pid3=$langs->transcountry("ProfId3", $mysoc->country_code); - if ($pid3 == '-') $pid3=false; - } - else - { - $pid3 = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid3) - { - print ''.$langs->trans("ShowProfIdInAddress").' - '.$pid3.''; - print $form->selectyesno('MAIN_PROFID3_IN_ADDRESS', isset($conf->global->MAIN_PROFID3_IN_ADDRESS)?$conf->global->MAIN_PROFID3_IN_ADDRESS:0, 1, $noCountryCode); - print ''; - } - - // Show prof id 4 in address into pdf - - if (! $noCountryCode) - { - $pid4=$langs->transcountry("ProfId4", $mysoc->country_code); - if ($pid4 == '-') $pid4=false; - } - else - { - $pid4 = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid4) - { - print ''.$langs->trans("ShowProfIdInAddress").' - '.$pid4.''; - print $form->selectyesno('MAIN_PROFID4_IN_ADDRESS', isset($conf->global->MAIN_PROFID4_IN_ADDRESS)?$conf->global->MAIN_PROFID4_IN_ADDRESS:0, 1, $noCountryCode); - print ''; + if (! $noCountryCode) + { + $pid=$langs->transcountry("ProfId".$i, $mysoc->country_code); + if ($pid == '-') $pid=false; + } + else + { + $pid = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; + } + if ($pid) + { + print ''.$langs->trans("ShowProfIdInAddress").' - '.$pid.''; + $keyforconstant = 'MAIN_PROFID'.$i.'_IN_ADDRESS'; + print $form->selectyesno($keyforconstant, isset($conf->global->$keyforconstant)?$conf->global->$keyforconstant:0, 1, $noCountryCode); + print ''; + } } print ''; @@ -419,77 +370,26 @@ else // Show print yn($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS, 1); print ''; - // Show prof id 1 in address into pdf - - if (! $noCountryCode) - { - $pid1=$langs->transcountry("ProfId1", $mysoc->country_code); - if ($pid1 == '-') $pid1=false; - } - else - { - $pid1 = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid1) - { - print ''.$langs->trans("ShowProfIdInAddress").' - '.$pid1.''; - print yn($conf->global->MAIN_PROFID1_IN_ADDRESS, 1); - print ''; - } - - // Show prof id 2 in address into pdf - - if (! $noCountryCode) - { - $pid2=$langs->transcountry("ProfId2", $mysoc->country_code); - if ($pid2 == '-') $pid2=false; - } - else - { - $pid2 = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid2) - { - print ''.$langs->trans("ShowProfIdInAddress").' - '.$pid2.''; - print yn($conf->global->MAIN_PROFID2_IN_ADDRESS, 1); - print ''; - } - - // Show prof id 3 in address into pdf - - if (! $noCountryCode) - { - $pid3=$langs->transcountry("ProfId3", $mysoc->country_code); - if ($pid3 == '-') $pid3=false; - } - else - { - $pid3 = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid3) - { - print ''.$langs->trans("ShowProfIdInAddress").' - '.$pid3.''; - print yn($conf->global->MAIN_PROFID3_IN_ADDRESS, 1); - print ''; - } - - // Show prof id 4 in address into pdf - - if (! $noCountryCode) - { - $pid4=$langs->transcountry("ProfId4", $mysoc->country_code); - if ($pid4 == '-') $pid4=false; - } - else - { - $pid4 = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid4) - { - print ''.$langs->trans("ShowProfIdInAddress").' - '.$pid4.''; - print yn($conf->global->MAIN_PROFID4_IN_ADDRESS, 1); - print ''; - } + // Show prof id in address into pdf + for ($i=1; $i<=6; $i++) + { + if (! $noCountryCode) + { + $pid=$langs->transcountry("ProfId".$i, $mysoc->country_code); + if ($pid == '-') $pid=false; + } + else + { + $pid = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; + } + if ($pid) + { + print ''.$langs->trans("ShowProfIdInAddress").' - '.$pid.''; + $keyforconstant = 'MAIN_PROFID'.$i.'_IN_ADDRESS'; + print yn($conf->global->$keyforconstant, 1); + print ''; + } + } print ''."\n"; print ''; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index caea57280b9..22e9dbf663c 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1276,14 +1276,16 @@ class ExtraFields $labeltoshow = dol_trunc($labeltoshow, 45); if ($value == $obj->rowid) { - foreach ($fields_label as $field_toshow) { - $translabel = $langs->trans($obj->$field_toshow); - if ($translabel != $obj->$field_toshow) { - $labeltoshow = dol_trunc($translabel, 18) . ' '; - } else { - $labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' '; - } - } + if (!$notrans) { + foreach ($fields_label as $field_toshow) { + $translabel = $langs->trans($obj->$field_toshow); + if ($translabel != $obj->$field_toshow) { + $labeltoshow = dol_trunc($translabel, 18) . ' '; + } else { + $labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' '; + } + } + } $out .= ''; } else { if (!$notrans) { diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 8ebe6f71425..fc0a52e4f62 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -582,7 +582,7 @@ class Project extends CommonObject } elseif ($type == 'project_task') { - $sql = "SELECT DISTINCT pt.rowid FROM " . MAIN_DB_PREFIX . "projet_task as pt, " . MAIN_DB_PREFIX . "projet_task_time as ptt WHERE pt.rowid = ptt.fk_task AND pt.fk_projet IN (". $ids .")"; + $sql = "SELECT DISTINCT pt.rowid FROM " . MAIN_DB_PREFIX . "projet_task as pt WHERE pt.fk_projet IN (". $ids .")"; } elseif ($type == 'project_task_time') // Case we want to duplicate line foreach user {