Merge branch 'develop' of ssh://git@github.com/Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2012-01-14 00:45:30 +01:00
commit 66d271c185
10 changed files with 168 additions and 103 deletions

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
@ -45,12 +45,12 @@ $langs->load('bills');
$langs->load('orders'); $langs->load('orders');
$langs->load('products'); $langs->load('products');
$id=GETPOST('id'); $id=GETPOST('id','int');
$ref=GETPOST('ref'); $ref=GETPOST('ref','alpha');
$socid=GETPOST('socid'); $socid=GETPOST('socid','int');
$action=GETPOST('action'); $action=GETPOST('action','alpha');
$confirm=GETPOST('confirm'); $confirm=GETPOST('confirm','alpha');
$lineid=GETPOST('lineid'); $lineid=GETPOST('lineid','int');
$search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','alpha'); $search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','alpha');
$search_societe=GETPOST('search_societe','alpha'); $search_societe=GETPOST('search_societe','alpha');
@ -124,7 +124,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
} }
// Suppression de la propale // Suppression de la propale
if ($action == 'confirm_delete' && $confirm == 'yes') else if ($action == 'confirm_delete' && $confirm == 'yes')
{ {
if ($user->rights->propale->supprimer) if ($user->rights->propale->supprimer)
{ {
@ -148,7 +148,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes')
} }
// Remove line // Remove line
if ($action == 'confirm_deleteline' && $confirm == 'yes') else if ($action == 'confirm_deleteline' && $confirm == 'yes')
{ {
if ($user->rights->propale->creer) if ($user->rights->propale->creer)
{ {
@ -184,7 +184,7 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes')
} }
// Validation // Validation
if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->propale->valider) else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->propale->valider)
{ {
$object->fetch($id); $object->fetch($id);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
@ -214,7 +214,7 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->propale
} }
} }
if ($_POST['action'] == 'setdate') else if ($action == 'setdate')
{ {
$datep=dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $datep=dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
@ -231,20 +231,20 @@ if ($_POST['action'] == 'setdate')
if ($result < 0) dol_print_error($db,$object->error); if ($result < 0) dol_print_error($db,$object->error);
} }
} }
if ($_POST['action'] == 'setecheance') else if ($action == 'setecheance')
{ {
$object->fetch($id); $object->fetch($id);
$result=$object->set_echeance($user,dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear'])); $result=$object->set_echeance($user,dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']));
if ($result < 0) dol_print_error($db,$object->error); if ($result < 0) dol_print_error($db,$object->error);
} }
if ($_POST['action'] == 'setdate_livraison') else if ($action == 'setdate_livraison')
{ {
$object->fetch($id); $object->fetch($id);
$result=$object->set_date_livraison($user,dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year'])); $result=$object->set_date_livraison($user,dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']));
if ($result < 0) dol_print_error($db,$object->error); if ($result < 0) dol_print_error($db,$object->error);
} }
if ($_POST['action'] == 'setaddress' && $user->rights->propale->creer) else if ($action == 'setaddress' && $user->rights->propale->creer)
{ {
$object->fetch($id); $object->fetch($id);
$result=$object->set_adresse_livraison($user,$_POST['fk_address']); $result=$object->set_adresse_livraison($user,$_POST['fk_address']);
@ -252,14 +252,14 @@ if ($_POST['action'] == 'setaddress' && $user->rights->propale->creer)
} }
// Positionne ref client // Positionne ref client
if ($_POST['action'] == 'set_ref_client' && $user->rights->propale->creer) else if ($action == 'set_ref_client' && $user->rights->propale->creer)
{ {
$object->fetch($id); $object->fetch($id);
$object->set_ref_client($user, $_POST['ref_client']); $object->set_ref_client($user, $_POST['ref_client']);
} }
// Create proposal // Create proposal
if ($_POST['action'] == 'add' && $user->rights->propale->creer) else if ($action == 'add' && $user->rights->propale->creer)
{ {
$object->socid=$socid; $object->socid=$socid;
$object->fetch_thirdparty(); $object->fetch_thirdparty();
@ -400,14 +400,14 @@ if ($_POST['action'] == 'add' && $user->rights->propale->creer)
} }
// Classify billed // Classify billed
if ($action == 'classifybilled') else if ($action == 'classifybilled')
{ {
$object->fetch($id); $object->fetch($id);
$object->cloture($user, 4, ''); $object->cloture($user, 4, '');
} }
// Reopen proposal // Reopen proposal
if ($action == 'confirm_reopen' && $user->rights->propale->cloturer) else if ($action == 'confirm_reopen' && $user->rights->propale->cloturer)
{ {
if (! $_POST['cancel']) if (! $_POST['cancel'])
{ {
@ -421,7 +421,7 @@ if ($action == 'confirm_reopen' && $user->rights->propale->cloturer)
} }
// Close proposal // Close proposal
if ($action == 'setstatut' && $user->rights->propale->cloturer) else if ($action == 'setstatut' && $user->rights->propale->cloturer)
{ {
if (! $_POST['cancel']) if (! $_POST['cancel'])
{ {
@ -481,7 +481,7 @@ if (! empty($_POST['removedfile']))
/* /*
* Send mail * Send mail
*/ */
if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel']) if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel'])
{ {
$langs->load('mails'); $langs->load('mails');
@ -653,7 +653,7 @@ if ($action == 'modif' && $user->rights->propale->creer)
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager); if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager);
} }
if ($_POST['action'] == "setabsolutediscount" && $user->rights->propale->creer) else if ($action == "setabsolutediscount" && $user->rights->propale->creer)
{ {
if ($_POST["remise_id"]) if ($_POST["remise_id"])
{ {
@ -674,10 +674,8 @@ if ($_POST['action'] == "setabsolutediscount" && $user->rights->propale->creer)
} }
} }
/* //Ajout d'une ligne produit dans la propale
* Ajout d'une ligne produit dans la propale else if ($action == "addline" && $user->rights->propale->creer)
*/
if ($_POST['action'] == "addline" && $user->rights->propale->creer)
{ {
$result=0; $result=0;
@ -747,8 +745,27 @@ if ($_POST['action'] == "addline" && $user->rights->propale->creer)
} }
} }
$desc = $prod->description; // Define output language
$desc.= ($prod->description && $_POST['np_desc']) ? ((dol_textishtml($prod->description) || dol_textishtml($_POST['np_desc']))?"<br>\n":"\n") : ""; if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_DESC_IN_THIRDPARTY_LANGUAGE))
{
$outputlangs = $langs;
$newlang='';
if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
if (empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$desc = (! empty($prod->multilangs[$outputlangs->defaultlang]["description"])) ? $prod->multilangs[$outputlangs->defaultlang]["description"] : $prod->description;
}
else
{
$desc = $prod->description;
}
$desc.= ($desc && $_POST['np_desc']) ? ((dol_textishtml($desc) || dol_textishtml($_POST['np_desc']))?"<br />\n":"\n") : "";
$desc.= $_POST['np_desc']; $desc.= $_POST['np_desc'];
$type = $prod->type; $type = $prod->type;
} }
@ -824,10 +841,8 @@ if ($_POST['action'] == "addline" && $user->rights->propale->creer)
} }
} }
/* // Mise a jour d'une ligne dans la propale
* Mise a jour d'une ligne dans la propale if ($action == 'updateligne' && $user->rights->propale->creer && $_POST["save"] == $langs->trans("Save"))
*/
if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST["save"] == $langs->trans("Save"))
{ {
if (! $object->fetch($_POST["id"]) > 0) if (! $object->fetch($_POST["id"]) > 0)
{ {
@ -899,10 +914,8 @@ if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST
} }
} }
/* // Generation doc (depuis lien ou depuis cartouche doc)
* Generation doc (depuis lien ou depuis cartouche doc) else if ($action == 'builddoc' && $user->rights->propale->creer)
*/
if ($action == 'builddoc' && $user->rights->propale->creer)
{ {
$object->fetch($id); $object->fetch($id);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
@ -936,63 +949,57 @@ if ($action == 'builddoc' && $user->rights->propale->creer)
} }
// Set project // Set project
if ($_POST['action'] == 'classin') else if ($action == 'classin')
{ {
$object->fetch($id); $object->fetch($id);
$object->setProject($_POST['projectid']); $object->setProject($_POST['projectid']);
} }
// Delai de livraison // Delai de livraison
if ($_POST["action"] == 'setavailability') else if ($action == 'setavailability')
{ {
$object->fetch($_REQUEST['id']); $object->fetch($id);
$result = $object->availability($_POST['availability_id']); $result = $object->availability($_POST['availability_id']);
$id=$_REQUEST['id'];
} }
// Origine de la propale // Origine de la propale
if ($_POST["action"] == 'setdemandreason') else if ($action == 'setdemandreason')
{ {
$object->fetch($_REQUEST['id']); $object->fetch($id);
$result = $object->demand_reason($_POST['demand_reason_id']); $result = $object->demand_reason($_POST['demand_reason_id']);
$id=$_REQUEST['id'];
} }
// Conditions de reglement // Conditions de reglement
if ($_POST["action"] == 'setconditions') else if ($action == 'setconditions')
{ {
$object->fetch($_REQUEST['id']); $object->fetch($id);
$result = $object->cond_reglement($_POST['cond_reglement_id']); $result = $object->cond_reglement($_POST['cond_reglement_id']);
$id=$_REQUEST['id'];
} }
if ($action == 'setremisepercent' && $user->rights->propale->creer) else if ($action == 'setremisepercent' && $user->rights->propale->creer)
{ {
$object->fetch($_REQUEST["id"]); $object->fetch($id);
$result = $object->set_remise_percent($user, $_POST['remise_percent']); $result = $object->set_remise_percent($user, $_POST['remise_percent']);
$id=$_REQUEST["id"];
} }
if ($action == 'setremiseabsolue' && $user->rights->propale->creer) else if ($action == 'setremiseabsolue' && $user->rights->propale->creer)
{ {
$object->fetch($_REQUEST["id"]); $object->fetch($id);
$result = $object->set_remise_absolue($user, $_POST['remise_absolue']); $result = $object->set_remise_absolue($user, $_POST['remise_absolue']);
$id=$_REQUEST["id"];
} }
// Mode de reglement // Mode de reglement
if ($_POST["action"] == 'setmode') else if ($action == 'setmode')
{ {
$object->fetch($_REQUEST["id"]); $object->fetch($id);
$result = $object->mode_reglement($_POST['mode_reglement_id']); $result = $object->mode_reglement($_POST['mode_reglement_id']);
$id=$_REQUEST["id"];
} }
/* /*
* Ordonnancement des lignes * Ordonnancement des lignes
*/ */
if ($action == 'up' && $user->rights->propale->creer) else if ($action == 'up' && $user->rights->propale->creer)
{ {
$object->fetch($id); $object->fetch($id);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
@ -1014,7 +1021,7 @@ if ($action == 'up' && $user->rights->propale->creer)
exit; exit;
} }
if ($action == 'down' && $user->rights->propale->creer) else if ($action == 'down' && $user->rights->propale->creer)
{ {
$object->fetch($id); $object->fetch($id);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
@ -1050,9 +1057,6 @@ $companystatic=new Societe($db);
$now=dol_now(); $now=dol_now();
$id = GETPOST('id');
$ref= GETPOST('ref');
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {
/* /*

View File

@ -552,8 +552,27 @@ if ($action == 'addline' && $user->rights->commande->creer)
} }
} }
$desc = $prod->description; // Define output language
$desc.= ($prod->description && $_POST['np_desc']) ? ((dol_textishtml($prod->description) || dol_textishtml($_POST['np_desc']))?"<br>\n":"\n") : ""; if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_DESC_IN_THIRDPARTY_LANGUAGE))
{
$outputlangs = $langs;
$newlang='';
if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
if (empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$desc = (! empty($prod->multilangs[$outputlangs->defaultlang]["description"])) ? $prod->multilangs[$outputlangs->defaultlang]["description"] : $prod->description;
}
else
{
$desc = $prod->description;
}
$desc.= ($desc && $_POST['np_desc']) ? ((dol_textishtml($desc) || dol_textishtml($_POST['np_desc']))?"<br />\n":"\n") : "";
$desc.= $_POST['np_desc']; $desc.= $_POST['np_desc'];
$type = $prod->type; $type = $prod->type;
} }

View File

@ -996,8 +996,27 @@ if (($action == 'addline' || $action == 'addline_predef') && $user->rights->fact
} }
} }
$desc = $prod->description; // Define output language
$desc.= ($prod->description && $_POST['np_desc']) ? ((dol_textishtml($prod->description) || dol_textishtml($_POST['np_desc']))?"<br>\n":"\n") : ""; if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_DESC_IN_THIRDPARTY_LANGUAGE))
{
$outputlangs = $langs;
$newlang='';
if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
if (empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$desc = (! empty($prod->multilangs[$outputlangs->defaultlang]["description"])) ? $prod->multilangs[$outputlangs->defaultlang]["description"] : $prod->description;
}
else
{
$desc = $prod->description;
}
$desc.= ($desc && $_POST['np_desc']) ? ((dol_textishtml($desc) || dol_textishtml($_POST['np_desc']))?"<br>\n":"\n") : "";
$desc.= $_POST['np_desc']; $desc.= $_POST['np_desc'];
if (! empty($prod->customcode) || ! empty($prod->country_code)) if (! empty($prod->customcode) || ! empty($prod->country_code))
{ {

View File

@ -81,7 +81,7 @@ class Translate {
$newdir=$dir.$conf->global->MAIN_FORCELANGDIR; $newdir=$dir.$conf->global->MAIN_FORCELANGDIR;
if (! in_array($newdir,$this->dir)) if (! in_array($newdir,$this->dir))
{ {
$more['module_'.$i]=$newdir; $i++; $more['module_'.$i]=$newdir; $i++; // TODO a quoi ça sert ??
} }
} }
$this->dir=array_merge($more,$this->dir); $this->dir=array_merge($more,$this->dir);
@ -193,7 +193,6 @@ class Translate {
if ($alt < 1 && strtolower($langarray[0]) == strtolower($langarray[1])) $alt=1; if ($alt < 1 && strtolower($langarray[0]) == strtolower($langarray[1])) $alt=1;
if ($alt < 2 && (strtolower($langofdir) == 'en_us' || strtolower($langofdir) == 'fr_fr' || strtolower($langofdir) == 'es_es')) $alt=2; if ($alt < 2 && (strtolower($langofdir) == 'en_us' || strtolower($langofdir) == 'fr_fr' || strtolower($langofdir) == 'es_es')) $alt=2;
foreach($this->dir as $keydir => $searchdir) foreach($this->dir as $keydir => $searchdir)
{ {
// Directory of translation files // Directory of translation files
@ -250,7 +249,7 @@ class Translate {
$tab=explode('=',$line,2); $tab=explode('=',$line,2);
$key=trim($tab[0]); $key=trim($tab[0]);
//print "Domain=$domain, found a string for $tab[0] with value $tab[1]<br>"; //print "Domain=$domain, found a string for $tab[0] with value $tab[1]<br>";
if (empty($this->tab_translate[$key]) && isset($tab[1])) if ((! empty($conf->global->MAIN_FORCELANGDIR) || empty($this->tab_translate[$key])) && isset($tab[1]))
{ {
$value=trim(preg_replace('/\\n/',"\n",$tab[1])); $value=trim(preg_replace('/\\n/',"\n",$tab[1]));

View File

@ -1111,6 +1111,7 @@ NumberOfProductShowInSelect=Max number of products in combos select lists (0=no
ConfirmDeleteProductLineAbility=Confirmation when removing product lines in forms ConfirmDeleteProductLineAbility=Confirmation when removing product lines in forms
ModifyProductDescAbility=Personalization of product descriptions in forms ModifyProductDescAbility=Personalization of product descriptions in forms
ViewProductDescInFormAbility=Visualization of product descriptions in the forms (otherwise as popup tooltip) ViewProductDescInFormAbility=Visualization of product descriptions in the forms (otherwise as popup tooltip)
ViewProductDescInThirdpartyLanguageAbility=Visualization of products descriptions in the thirdparty language
UseSearchToSelectProduct=Use a search form to choose a product (instead of using a list box).<br>Also if you have a large number of product (> 100 000), you can increase speed by setting constant PRODUCT_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string. UseSearchToSelectProduct=Use a search form to choose a product (instead of using a list box).<br>Also if you have a large number of product (> 100 000), you can increase speed by setting constant PRODUCT_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string.
UseEcoTaxeAbility=Support Eco-Taxe (WEEE) UseEcoTaxeAbility=Support Eco-Taxe (WEEE)
SetDefaultBarcodeTypeProducts=Default barcode type to use for products SetDefaultBarcodeTypeProducts=Default barcode type to use for products

View File

@ -1119,6 +1119,7 @@ NumberOfProductShowInSelect= Nombre de produits max dans les listes déroulantes
ConfirmDeleteProductLineAbility= Confirmation de suppression d'une ligne produit dans les formulaires ConfirmDeleteProductLineAbility= Confirmation de suppression d'une ligne produit dans les formulaires
ModifyProductDescAbility= Personnalisation des descriptions produits dans les formulaires ModifyProductDescAbility= Personnalisation des descriptions produits dans les formulaires
ViewProductDescInFormAbility= Visualisation des descriptions produits dans les formulaires (sinon en tant que tooltip) ViewProductDescInFormAbility= Visualisation des descriptions produits dans les formulaires (sinon en tant que tooltip)
ViewProductDescInThirdpartyLanguageAbility= Visualisation des descriptions produits dans la langue du tiers
UseSearchToSelectProduct= Utiliser un formulaire de recherche pour le choix d'un produit (plutôt qu'une liste déroulante).<br>Notez que si vous avez un nombre important de produits ou services (> 100 000), vous pouvez améliorer les performances en définissant la constante PRODUCT_DONOTSEARCH_ANYWHERE à 1 dans Configuration->Divers. La recherche sera alors limitée au début de la chaine. UseSearchToSelectProduct= Utiliser un formulaire de recherche pour le choix d'un produit (plutôt qu'une liste déroulante).<br>Notez que si vous avez un nombre important de produits ou services (> 100 000), vous pouvez améliorer les performances en définissant la constante PRODUCT_DONOTSEARCH_ANYWHERE à 1 dans Configuration->Divers. La recherche sera alors limitée au début de la chaine.
UseEcoTaxeAbility= Prise en charge des éco-taxes (DEEE) UseEcoTaxeAbility= Prise en charge des éco-taxes (DEEE)
SetDefaultBarcodeTypeProducts= Type de code-barres utilisé par défaut pour les produits SetDefaultBarcodeTypeProducts= Type de code-barres utilisé par défaut pour les produits

View File

@ -3,7 +3,7 @@
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2006-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2006-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007 Auguria SARL <info@auguria.org> * Copyright (C) 2007 Auguria SARL <info@auguria.org>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -69,6 +69,11 @@ else if ($action == 'viewProdDescInForm')
$view = GETPOST("activate_viewProdDescInForm"); $view = GETPOST("activate_viewProdDescInForm");
$res = dolibarr_set_const($db, "PRODUIT_DESC_IN_FORM", $view,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "PRODUIT_DESC_IN_FORM", $view,'chaine',0,'',$conf->entity);
} }
else if ($action == 'viewProdDescInThirdpartyLanguage')
{
$view = GETPOST("activate_viewProdDescInThirdpartyLanguage");
$res = dolibarr_set_const($db, "PRODUIT_DESC_IN_THIRDPARTY_LANGUAGE", $view,'chaine',0,'',$conf->entity);
}
else if ($action == 'usesearchtoselectproduct') else if ($action == 'usesearchtoselectproduct')
{ {
$usesearch = GETPOST("activate_usesearchtoselectproduct"); $usesearch = GETPOST("activate_usesearchtoselectproduct");
@ -249,6 +254,25 @@ print '</td>';
print '</tr>'; print '</tr>';
print '</form>'; print '</form>';
// View product description in thirdparty language
if (! empty($conf->global->MAIN_MULTILANGS))
{
$var=!$var;
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="viewProdDescInThirdpartyLanguage">';
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("ViewProductDescInThirdpartyLanguageAbility").'</td>';
print '<td width="60" align="right">';
print $form->selectyesno("activate_viewProdDescInThirdpartyLanguage",$conf->global->PRODUIT_DESC_IN_THIRDPARTY_LANGUAGE,1);
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</td>';
print '</tr>';
print '</form>';
}
if ($conf->global->PRODUCT_CANVAS_ABILITY) if ($conf->global->PRODUCT_CANVAS_ABILITY)
{ {
// Add canvas feature // Add canvas feature
@ -319,7 +343,8 @@ if ($conf->global->PRODUCT_CANVAS_ABILITY)
dol_htmloutput_mesg($mesg); dol_htmloutput_mesg($mesg);
llxFooter();
$db->close(); $db->close();
llxFooter();
?> ?>

View File

@ -95,11 +95,11 @@ class User extends CommonObject
/** /**
* Constructor de la classe * Constructor de la classe
* *
* @param DoliDb $DB Database handler * @param DoliDb $db Database handler
*/ */
function User($DB) function __construct($db)
{ {
$this->db = $DB; $this->db = $db;
// Preference utilisateur // Preference utilisateur
$this->liste_limit = 0; $this->liste_limit = 0;
@ -107,8 +107,6 @@ class User extends CommonObject
$this->all_permissions_are_loaded = 0; $this->all_permissions_are_loaded = 0;
$this->admin=0; $this->admin=0;
return 1;
} }
/** /**
@ -853,12 +851,15 @@ class User extends CommonObject
$error=0; $error=0;
// Positionne parametres // Positionne parametres
$this->admin = 0; $this->admin = 0;
$this->nom = $contact->nom; // TODO deprecated $this->nom = $contact->nom; // TODO deprecated
$this->prenom = $contact->prenom; // TODO deprecated $this->prenom = $contact->prenom; // TODO deprecated
$this->lastname = $contact->nom; $this->lastname = $contact->nom;
$this->firstname = $contact->prenom; $this->firstname = $contact->prenom;
$this->email = $contact->email; $this->email = $contact->email;
$this->office_phone = $contact->phone_pro;
$this->office_fax = $contact->fax;
$this->user_mobile = $contact->phone_mobile;
if (empty($login)) $login=strtolower(substr($contact->prenom, 0, 4)) . strtolower(substr($contact->nom, 0, 4)); if (empty($login)) $login=strtolower(substr($contact->prenom, 0, 4)) . strtolower(substr($contact->nom, 0, 4));
$this->login = $login; $this->login = $login;
@ -871,6 +872,9 @@ class User extends CommonObject
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX."user"; $sql = "UPDATE ".MAIN_DB_PREFIX."user";
$sql.= " SET fk_socpeople=".$contact->id; $sql.= " SET fk_socpeople=".$contact->id;
$sql.= ", office_phone = '".$this->db->escape($this->office_phone)."'";
$sql.= ", office_fax = '".$this->db->escape($this->office_fax)."'";
$sql.= ", user_mobile = '".$this->db->escape($this->user_mobile)."'";
if ($contact->socid) $sql.=", fk_societe=".$contact->socid; if ($contact->socid) $sql.=", fk_societe=".$contact->socid;
$sql.= " WHERE rowid=".$this->id; $sql.= " WHERE rowid=".$this->id;
$resql=$this->db->query($sql); $resql=$this->db->query($sql);

View File

@ -43,10 +43,10 @@ if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
$langs->load("users"); $langs->load("users");
$langs->load("other"); $langs->load("other");
$id=GETPOST("id"); $id=GETPOST('id', 'int');
$action=GETPOST("action"); $action=GETPOST('action', 'alpha');
$confirm=GETPOST("confirm"); $confirm=GETPOST('confirm', 'alpha');
$userid=GETPOST("user","int"); $userid=GETPOST('user', 'int');
// Security check // Security check
$result = restrictedArea($user, 'user', $id, 'usergroup&usergroup', 'user'); $result = restrictedArea($user, 'user', $id, 'usergroup&usergroup', 'user');
@ -66,7 +66,7 @@ if ($action == 'confirm_delete' && $confirm == "yes")
{ {
if ($caneditperms) if ($caneditperms)
{ {
$object->fetch($_GET["id"]); $object->fetch($id);
$object->delete(); $object->delete();
Header("Location: index.php"); Header("Location: index.php");
exit; exit;
@ -95,12 +95,11 @@ if ($action == 'add')
if (! $message) if (! $message)
{ {
$object->nom = trim($_POST["nom"]); $object->nom = trim($_POST["nom"]);
if($conf->multicompany->enabled && !empty($conf->multicompany->transverse_mode))
$object->entity = 0;
else
$object->entity = $_POST["entity"];
$object->note = trim($_POST["note"]); $object->note = trim($_POST["note"]);
if($conf->multicompany->enabled && ! empty($conf->multicompany->transverse_mode)) $object->entity = 0;
else $object->entity = $_POST["entity"];
$db->begin(); $db->begin();
$id = $object->create(); $id = $object->create();
@ -176,12 +175,11 @@ if ($action == 'update')
$object->oldcopy=dol_clone($object); $object->oldcopy=dol_clone($object);
$object->nom = trim($_POST["group"]); $object->nom = trim($_POST["group"]);
if($conf->multicompany->enabled && !empty($conf->multicompany->transverse_mode))
$object->entity = 0;
else
$object->entity = $_POST["entity"];
$object->note = dol_htmlcleanlastbr($_POST["note"]); $object->note = dol_htmlcleanlastbr($_POST["note"]);
if($conf->multicompany->enabled && !empty($conf->multicompany->transverse_mode)) $object->entity = 0;
else $object->entity = $_POST["entity"];
$ret=$object->update(); $ret=$object->update();
if ($ret >= 0 && ! count($object->errors)) if ($ret >= 0 && ! count($object->errors))
@ -507,5 +505,6 @@ else
llxFooter(); llxFooter();
if (is_object($db)) $db->close(); $db->close();
?> ?>

View File

@ -40,12 +40,10 @@ if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
} }
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$action = GETPOST('action', 'alpha');
$socid=0; $socid=0;
if ($user->societe_id > 0) if ($user->societe_id > 0) $socid = $user->societe_id;
{
$socid = $user->societe_id;
}
$fgroup = new Usergroup($db); $fgroup = new Usergroup($db);
$fgroup->fetch($id); $fgroup->fetch($id);
@ -56,7 +54,7 @@ $fgroup->getrights();
* Actions * Actions
*/ */
if ($_GET["action"] == 'dolibarr2ldap') if ($action == 'dolibarr2ldap')
{ {
$message=""; $message="";
@ -84,8 +82,6 @@ if ($_GET["action"] == 'dolibarr2ldap')
} }
/* /*
* View * View
*/ */
@ -208,10 +204,8 @@ else
print '</table>'; print '</table>';
llxFooter();
$db->close(); $db->close();
llxFooter();
?> ?>