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 ''; - print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), 'country', '', 28); + $fieldname='country'; + print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), $fieldname, '', 28); print ''; } elseif ($fieldlist[$field] == 'country_id') { - $country_id = (! empty($obj->$fieldlist[$field]) ? $obj->$fieldlist[$field] : 0); - print ''; - print ''; - 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 ''; + print ''; + print ''; + } } elseif ($fieldlist[$field] == 'region') { 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 '
'; print ''; @@ -98,7 +98,7 @@ foreach ($list as $key) print ''; // Param - $label = $langs->trans($key); + $label = $langs->trans($key); print ''; // Value diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index ea17d895b95..b152a38db02 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -229,7 +229,7 @@ if ($resql) if ($viewstatut == 1) $title.=' - '.$langs->trans('StatusOrderValidatedShort'); if ($viewstatut == 2) - $title.=' - '.$langs->trans('StatusOrderOnProcessShort'); + $title.=' - '.$langs->trans('StatusOrderSentShort'); if ($viewstatut == 3) $title.=' - '.$langs->trans('StatusOrderToBillShort'); if ($viewstatut == 4) @@ -295,7 +295,7 @@ if ($resql) print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'c.total_ht','',$param, 'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'c.fk_statut','',$param,'align="right"',$sortfield,$sortorder); print ''; - + print ''; print ''; print ''; diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index e995ee45d54..8263dc76cb8 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -132,6 +132,8 @@ $tableparams = array_merge($commonparams, $tableparams); foreach($allparams as $key => $value) { $paramslink .= '&' . $key . '=' . $value; } + + /* * View */ @@ -174,12 +176,12 @@ report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportl // SQL request $catotal=0; -if ($modecompta == 'CREANCES-DETTES') +if ($modecompta == 'CREANCES-DETTES') { $sql = "SELECT DISTINCT p.rowid as rowid, p.ref as ref, p.label as label,"; $sql.= " sum(l.total_ht) as amount, sum(l.total_ttc) as amount_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as l, ".MAIN_DB_PREFIX."product as p"; - if ($selected_cat === -2) // Without any category + if ($selected_cat === -2) // Without any category { $sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; } @@ -198,7 +200,7 @@ if ($modecompta == 'CREANCES-DETTES') if ($date_start && $date_end) { $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; } - if ($selected_cat === -2) // Without any category + if ($selected_cat === -2) // Without any category { $sql.=" AND cp.fk_product is null"; } @@ -209,7 +211,7 @@ if ($modecompta == 'CREANCES-DETTES') $sql.= " AND cp.fk_categorie = c.rowid AND cp.fk_product = p.rowid"; } $sql.= " AND f.entity = ".$conf->entity; - $sql.= " GROUP BY p.rowid"; + $sql.= " GROUP BY p.rowid, p.ref, p.label"; $sql.= " ORDER BY p.ref"; dol_syslog("cabyprodserv", LOG_DEBUG); @@ -390,7 +392,7 @@ if ($modecompta == 'CREANCES-DETTES') // $modecompta != 'CREANCES-DETTES' // "Calculation of part of each product for accountancy in this mode is not possible. When a partial payment (for example 5 euros) is done on an // invoice with 2 product (product A for 10 euros and product B for 20 euros), what is part of paiment for product A and part of paiment for product B ? - // Because there is no way to know this, this report is not relevant. + // Because there is no way to know this, this report is not relevant. print '
'.$langs->trans("TurnoverPerProductInCommitmentAccountingNotRelevant") . '
'; } diff --git a/htdocs/compta/tva/reglement.php b/htdocs/compta/tva/reglement.php index 8babbd58f7d..ebba3888004 100644 --- a/htdocs/compta/tva/reglement.php +++ b/htdocs/compta/tva/reglement.php @@ -97,7 +97,6 @@ if ($filtre) { if ($typeid) { $sql .= " AND t.fk_typepayment=".$typeid; } -$sql.= " GROUP BY t.rowid, t.fk_typepayment, t.amount, t.datev, t.label"; $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1,$offset); @@ -111,7 +110,7 @@ if ($result) $param=''; if ($typeid) $param.='&typeid='.$typeid; - + print_barre_liste($langs->trans("VATPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines); print ''; @@ -125,7 +124,7 @@ if ($result) print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"t.amount","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre(""); print "\n"; - + print ''; print ''; print ''; @@ -138,21 +137,21 @@ if ($result) print ''; print ''; print "\n"; - + while ($i < min($num,$limit)) { $obj = $db->fetch_object($result); $var=!$var; - + if ($obj->payment_code <> '') { - $type = ''.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.''; + $type = ''.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.''; } else { $type = ' '; } - + print ""; $tva_static->id=$obj->rowid; @@ -172,12 +171,12 @@ if ($result) } print ''.$langs->trans("Total").''; print "".price($total).""; - print " "; + print " "; print ""; - + 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 ''; print ''; print ''; print '
'; - //print "$socid,$selected,$htmlname"; - $formproject->select_projects($socid,$selected,$htmlname); + $formproject->select_projects($socid,$selected,$htmlname,20,0,1,$discard_closed); print '
'; @@ -4103,20 +4103,20 @@ class Form if ($value_as_key) $array=array_combine($array, $array); $out=''; - - // Add code for jquery to use multiselect - if (empty($conf->dol_use_jmobile) && (! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))) - { - $tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT'):$conf->global->MAIN_USE_JQUERY_MULTISELECT; - $out=' - '; - } - + + // Add code for jquery to use multiselect + if (empty($conf->dol_use_jmobile) && (! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))) + { + $tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT'):$conf->global->MAIN_USE_JQUERY_MULTISELECT; + $out=' + '; + } + $out.='