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

This commit is contained in:
Laurent Destailleur 2016-03-17 23:45:29 +01:00
commit 404ac60226
3 changed files with 216 additions and 235 deletions

View File

@ -10,6 +10,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Adolfo segura <adolfo.segura@gmail.com> * Copyright (C) 2013 Adolfo segura <adolfo.segura@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Ferran Marcet <fmarcet@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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -79,6 +80,7 @@ if ($type === '0') { $contextpage='productlist'; if ($search_type=='') $search_t
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array($contextpage)); $hookmanager->initHooks(array($contextpage));
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
$form=new Form($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('product'); $extralabels = $extrafields->fetch_name_optionals_label('product');
@ -120,6 +122,15 @@ if (! empty($conf->barcode->enabled)) {
$fieldstosearchall['p.barcode']='Gencod'; $fieldstosearchall['p.barcode']='Gencod';
} }
if (empty($conf->global->PRODUIT_MULTIPRICES))
{
$titlesellprice=$langs->trans("SellingPrice");
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
{
$titlesellprice=$form->textwithpicto($langs->trans("SellingPrice"), $langs->trans("DefaultPriceRealPriceMayDependOnCustomer"));
}
}
// Definition of fields for lists // Definition of fields for lists
$arrayfields=array( $arrayfields=array(
'p.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), 'p.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
@ -176,7 +187,6 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
*/ */
$htmlother=new FormOther($db); $htmlother=new FormOther($db);
$form=new Form($db);
if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
{ {
@ -402,15 +412,6 @@ else
print '</div>'; print '</div>';
} }
if (empty($conf->global->PRODUIT_MULTIPRICES))
{
$titlesellprice=$langs->trans("SellingPrice");
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
{
$titlesellprice=$form->textwithpicto($langs->trans("SellingPrice"), $langs->trans("DefaultPriceRealPriceMayDependOnCustomer"));
}
}
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
@ -423,7 +424,7 @@ else
if (! empty($arrayfields['p.duration']['checked'])) print_liste_field_titre($arrayfields['p.duration']['label'], $_SERVER["PHP_SELF"],"p.duration","",$param,"",$sortfield,$sortorder); if (! empty($arrayfields['p.duration']['checked'])) print_liste_field_titre($arrayfields['p.duration']['label'], $_SERVER["PHP_SELF"],"p.duration","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['p.sellprice']['checked'])) print_liste_field_titre($arrayfields['p.sellprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['p.sellprice']['checked'])) print_liste_field_titre($arrayfields['p.sellprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['p.minbuyprice']['checked'])) print_liste_field_titre($arrayfields['p.minbuyprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['p.minbuyprice']['checked'])) print_liste_field_titre($arrayfields['p.minbuyprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['p.desiredstock']['checked'])) print_liste_field_titre($arrayfields['p.desiredstock']['label'], $_SERVER["PHP_SELF"],"p.desirestock","",$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['p.desiredstock']['checked'])) print_liste_field_titre($arrayfields['p.desiredstock']['label'], $_SERVER["PHP_SELF"],"p.desiredstock","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['p.tobatch']['checked'])) print_liste_field_titre($arrayfields['p.tobatch']['label'], $_SERVER["PHP_SELF"],"p.tobatch","",$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['p.tobatch']['checked'])) print_liste_field_titre($arrayfields['p.tobatch']['label'], $_SERVER["PHP_SELF"],"p.tobatch","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['p.stock']['checked'])) print_liste_field_titre($arrayfields['p.stock']['label'], $_SERVER["PHP_SELF"],"p.stock","",$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['p.stock']['checked'])) print_liste_field_titre($arrayfields['p.stock']['label'], $_SERVER["PHP_SELF"],"p.stock","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print_liste_field_titre($arrayfields['p.accountancy_code_sell']['label'], $_SERVER["PHP_SELF"],"p.accountancy_code_sell","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print_liste_field_titre($arrayfields['p.accountancy_code_sell']['label'], $_SERVER["PHP_SELF"],"p.accountancy_code_sell","",$param,'',$sortfield,$sortorder);

View File

@ -3,7 +3,7 @@
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2015 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-2015 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2016 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005 Lionel Cousteix <etm_ltd@tiscali.co.uk> * Copyright (C) 2005 Lionel Cousteix <etm_ltd@tiscali.co.uk>
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com> * Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
@ -349,6 +349,8 @@ if (empty($reshook)) {
$object->salaryextra = GETPOST("salaryextra") != '' ? GETPOST("salaryextra") : ''; $object->salaryextra = GETPOST("salaryextra") != '' ? GETPOST("salaryextra") : '';
$object->weeklyhours = GETPOST("weeklyhours") != '' ? GETPOST("weeklyhours") : ''; $object->weeklyhours = GETPOST("weeklyhours") != '' ? GETPOST("weeklyhours") : '';
$object->color = GETPOST("color") != '' ? GETPOST("color") : '';
if (! empty($conf->multicompany->enabled)) if (! empty($conf->multicompany->enabled))
{ {
if (! empty($_POST["superadmin"])) if (! empty($_POST["superadmin"]))
@ -375,20 +377,6 @@ if (empty($reshook)) {
$error ++; $error ++;
} }
if (!empty($conf->multicompany->enabled)) {
if (!empty($_POST["superadmin"])) {
$object->entity = 0;
} else {
if ($conf->multicompany->transverse_mode) {
$object->entity = 1; // all users in master entity
} else {
$object->entity = (empty($_POST["entity"]) ? 0 : $_POST["entity"]);
}
}
} else {
$object->entity = (empty($_POST["entity"]) ? 0 : $_POST["entity"]);
}
if (GETPOST('deletephoto')) { if (GETPOST('deletephoto')) {
$object->photo = ''; $object->photo = '';
} }
@ -412,7 +400,7 @@ if (empty($reshook)) {
} }
if (!$error && isset($_POST['contactid'])) { if (!$error && isset($_POST['contactid'])) {
$contactid = GETPOST('contactid'); $contactid = GETPOST('contactid', 'int');
if ($contactid > 0) { if ($contactid > 0) {
$contact = new Contact($db); $contact = new Contact($db);
@ -420,7 +408,7 @@ if (empty($reshook)) {
$sql = "UPDATE ".MAIN_DB_PREFIX."user"; $sql = "UPDATE ".MAIN_DB_PREFIX."user";
$sql .= " SET fk_socpeople=".$db->escape($contactid); $sql .= " SET fk_socpeople=".$db->escape($contactid);
if ($contact->socid) { if (!empty($contact->socid)) {
$sql .= ", fk_soc=".$db->escape($contact->socid); $sql .= ", fk_soc=".$db->escape($contact->socid);
} }
$sql .= " WHERE rowid=".$object->id; $sql .= " WHERE rowid=".$object->id;
@ -429,7 +417,7 @@ if (empty($reshook)) {
$sql .= " SET fk_socpeople=NULL, fk_soc=NULL"; $sql .= " SET fk_socpeople=NULL, fk_soc=NULL";
$sql .= " WHERE rowid=".$object->id; $sql .= " WHERE rowid=".$object->id;
} }
dol_syslog("fiche::update", LOG_DEBUG); dol_syslog("usercard::update", LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if (!$resql) { if (!$resql) {
$error ++; $error ++;
@ -493,17 +481,6 @@ if (empty($reshook)) {
{ {
$object->fetch($id); $object->fetch($id);
$object->oldcopy = dol_clone($object);
$ret = $object->setPassword($user, $_POST["password"]);
if ($ret < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
}
$object->oldcopy = clone $object; $object->oldcopy = clone $object;
$ret = $object->setPassword($user, $_POST["password"]); $ret = $object->setPassword($user, $_POST["password"]);
@ -512,6 +489,9 @@ if (empty($reshook)) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
}
}
}
// Change password with a new generated one // Change password with a new generated one
if ((($action == 'confirm_password' && $confirm == 'yes') if ((($action == 'confirm_password' && $confirm == 'yes')

View File

@ -4,7 +4,7 @@
* Copyright (c) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (c) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2016 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005 Lionel Cousteix <etm_ltd@tiscali.co.uk> * Copyright (C) 2005 Lionel Cousteix <etm_ltd@tiscali.co.uk>
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com> * Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
* Copyright (C) 2013-2014 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2013-2014 Philippe Grand <philippe.grand@atoo-net.com>
@ -1272,7 +1272,7 @@ class User extends CommonObject
$nbrowsaffected+=$this->db->affected_rows($resql); $nbrowsaffected+=$this->db->affected_rows($resql);
// Update password // Update password
if ($this->pass) if (!empty($this->pass))
{ {
if ($this->pass != $this->pass_indatabase && $this->pass != $this->pass_indatabase_crypted) if ($this->pass != $this->pass_indatabase && $this->pass != $this->pass_indatabase_crypted)
{ {