diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 05f60f9d8eb..edac096c8f0 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1521,6 +1521,10 @@ if ($action == 'create' && $user->rights->commande->creer) $objectsrc->fetch($originid); if (empty($objectsrc->lines) && method_exists($objectsrc,'fetch_lines')) $objectsrc->fetch_lines(); $objectsrc->fetch_thirdparty(); + + //Replicate extrafields + $objectsrc->fetch_optionals($originid); + $object->array_options=$objectsrc->array_options; $projectid = (!empty($objectsrc->fk_project)?$objectsrc->fk_project:''); $ref_client = (!empty($objectsrc->ref_client)?$objectsrc->ref_client:''); diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index ba1e48bb894..7e82e4d38d3 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2022,6 +2022,10 @@ if ($action == 'create') $remise_percent = (! empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0)); $remise_absolue = (! empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(! empty($soc->remise_absolue)?$soc->remise_absolue:0)); $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; + + //Replicate extrafields + $objectsrc->fetch_optionals($originid); + $object->array_options=$objectsrc->array_options; } } else @@ -2174,7 +2178,7 @@ if ($action == 'create') print ''."\n"; } - if ((empty($origin)) || (($origin=='propal') && (!empty($originid)))) + if ((empty($origin)) || ((($origin=='propal') || ($origin=='commande')) && (!empty($originid)))) { // Deposit print '
| '.$desc.' | '; - if (($origin=='propal') ) { + if (($origin=='propal') || ($origin=='commande')) { print ''; print ' | '.$langs->trans('Value').':'; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 331ab1c3b98..ff31407b5b8 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -800,7 +800,21 @@ class Form while ($i < $num) { $obj = $this->db->fetch_object($resql); - $label=$obj->nom; + + if ($conf->global->SOCIETE_ADD_REF_IN_LIST) { + if (($obj->client) && (!empty($obj->code_client))) { + $label = $obj->code_client. ' - '; + } + if (($obj->fournisseur) && (!empty($obj->code_fournisseur))) { + $label .= $obj->code_fournisseur. ' - '; + } + $label.=' '.$obj->nom; + } + else + { + $label=$obj->nom; + } + if ($showtype) { if ($obj->client || $obj->fournisseur) $label.=' ('; diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 20494adfc8a..b855eddaa41 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -124,6 +124,13 @@ class modSociete extends DolibarrModules $this->const[$r][4] = 1; $r++; */ + + $this->const[$r][0] = "SOCIETE_ADD_REF_IN_LIST"; + $this->const[$r][1] = "yesno"; + $this->const[$r][2] = "0"; + $this->const[$r][3] = "Display customer ref into select list"; + $this->const[$r][4] = 0; + $r++; // Boxes $this->boxes = array(); diff --git a/htdocs/core/modules/project/task/mod_task_simple.php b/htdocs/core/modules/project/task/mod_task_simple.php index 9413ff26b9c..13c23cb4f73 100644 --- a/htdocs/core/modules/project/task/mod_task_simple.php +++ b/htdocs/core/modules/project/task/mod_task_simple.php @@ -72,10 +72,11 @@ class mod_task_simple extends ModeleNumRefTask $coyymm=''; $max=''; $posindice=8; - $sql = "SELECT MAX(SUBSTRING(ref FROM ".$posindice.")) as max"; - $sql.= " FROM ".MAIN_DB_PREFIX."projet_task"; - $sql.= " WHERE ref LIKE '".$this->prefix."____-%'"; - $sql.= " AND entity = ".$conf->entity; + $sql = "SELECT MAX(SUBSTRING(task.ref FROM " . $posindice . ")) as max"; + $sql .= " FROM " . MAIN_DB_PREFIX . "projet_task AS task, "; + $sql .= MAIN_DB_PREFIX . "projet AS project WHERE task.fk_projet=project.rowid"; + $sql .= " AND task.ref LIKE '" . $this->prefix . "____-%'"; + $sql .= " AND project.entity = " . $conf->entity; $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index fb16e5cbadf..dbb3a215d5d 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -220,7 +220,12 @@ class Export if ($i > 0) $sql.=', '; else $i++; - $newfield=$key.' as '.str_replace(array('.', '-'),'_',$key);; + + if (strpos($key, ' as ')===false) { + $newfield=$key.' as '.str_replace(array('.', '-'),'_',$key); + } else { + $newfield=$key; + } $sql.=$newfield; } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index e63a8c8ecb4..0cb281fa45b 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1002,6 +1002,7 @@ BrowserIsOK=You are using the web browser %s. This browser is ok for security an BrowserIsKO=You are using the web browser %s. This browser is known to be a bad choice for security, performance and reliability. We recommand you to use Firefox, Chrome, Opera or Safari. XDebugInstalled=XDebug est chargé. XCacheInstalled=XCache is loaded. +AddRefInList=Display customer/supplier ref into list (select list or combobox) and most of hyperlink ##### Module password generation PasswordGenerationStandard=Return a password generated according to internal Dolibarr algorithm: 8 characters containing shared numbers and characters in lowercase. PasswordGenerationNone=Do not suggest any generated password. Password must be type in manually. diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index b8e3c8fe48c..4341d453fba 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1002,6 +1002,7 @@ BrowserIsOK=Vous utilisez le navigateur %s. Ce navigateur est réputé optimisé BrowserIsKO=Vous utilisez le navigateur %s. Ce navigateur est déconseillé pour des raisons de sécurité, performance et qualité des pages restituées. Nous vous recommandons d'utiliser Firefox, Chrome, Opera ou Safari. XDebugInstalled=XDebug est chargé. XCacheInstalled=XCache est chargé. +AddRefInList=Affiché le code client/fournisseur dans les liste (déroulante ou autocomplétion) et dans la pluspart des hyperliens ##### Module password generation PasswordGenerationStandard=Renvoie un mot de passe généré selon l'algorithme interne de Dolibarr : 8 caractères, chiffres et caractères en minuscules mélangés. PasswordGenerationNone=Ne propose pas de mots de passe générés. Le mot de passe est à saisir manuellement. diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index bd73628eec3..98f8e79fd1c 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -211,6 +211,22 @@ if ($action == 'setprofid') } } +//Activate Set ref in list +if ($action=="setaddrefinlist") { + $setaddrefinlist = GETPOST('value','int'); + $res = dolibarr_set_const($db, "SOCIETE_ADD_REF_IN_LIST", $setaddrefinlist,'yesno',0,'',$conf->entity); + if (! $res > 0) $error++; + if (! $error) + { + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $mesg = "".$langs->trans("Error").""; + } +} + + //Activate ProfId mandatory if ($action == 'setprofidmandatory') { @@ -717,6 +733,23 @@ else print ' | ||
| '.$langs->trans("AddRefInList").' | '; +if (!empty($conf->global->SOCIETE_ADD_REF_IN_LIST)) +{ + print ''; + print img_picto($langs->trans("Activated"),'switch_on'); + print ' | '; +} +else +{ + print ''; + print img_picto($langs->trans("Disabled"),'switch_off'); + print ' | '; +} +print '||