diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index b67ded65c6e..c48b00050f8 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -589,9 +589,7 @@ class Adherent extends CommonObject
$this->town = ($this->town ? $this->town : $this->town);
$this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id);
$this->state_id = ($this->state_id > 0 ? $this->state_id : $this->state_id);
- if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname = dol_ucwords(dol_strtolower($this->lastname));
- if (!empty($conf->global->MAIN_ALL_TO_UPPER)) $this->lastname = dol_strtoupper($this->lastname);
- if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname = dol_ucwords(dol_strtolower($this->firstname));
+ $this->setUpperOrLowerCase();
$this->note_public = ($this->note_public ? $this->note_public : $this->note_public);
$this->note_private = ($this->note_private ? $this->note_private : $this->note_private);
diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php
index 8a7f5415339..1950caa1de3 100644
--- a/htdocs/compta/bank/various_payment/card.php
+++ b/htdocs/compta/bank/various_payment/card.php
@@ -52,8 +52,12 @@ $sens = GETPOST("sens", "int");
$amount = price2num(GETPOST("amount", "alpha"));
$paymenttype = GETPOST("paymenttype", "int");
$accountancy_code = GETPOST("accountancy_code", "alpha");
-$subledger_account = GETPOST("subledger_account", "alpha");
$projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int'));
+if (!empty($conf->accounting->enabled) && !empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
+ $subledger_account = GETPOST("subledger_account", "alpha") > 0 ? GETPOST("subledger_account", "alpha") : '';
+} else {
+ $subledger_account = GETPOST("subledger_account", "alpha");
+}
// Security check
$socid = GETPOST("socid", "int");
@@ -116,7 +120,7 @@ if (empty($reshook))
$object->category_transaction = GETPOST("category_transaction", 'alpha');
$object->accountancy_code = GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code", "alpha") : "";
- $object->subledger_account = GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "alpha") : "";
+ $object->subledger_account = $subledger_account;
$object->sens = GETPOST('sens');
$object->fk_project = GETPOST('fk_project', 'int');
@@ -212,9 +216,11 @@ if (empty($reshook))
}
if ($action == 'setsubledger_account') {
+ $db->begin();
+
$result = $object->fetch($id);
- $object->subledger_account = (GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "alpha") : "");
+ $object->subledger_account = $subledger_account;
$res = $object->update($user);
if ($res > 0) {
@@ -436,7 +442,7 @@ if ($action == 'create')
// Subledger account
if (!empty($conf->accounting->enabled))
{
- print '
| '.$langs->trans("SubledgerAccount").'aaaa | ';
print '';
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
{
diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php
index 2fb2c56fc46..165c8675960 100644
--- a/htdocs/compta/bank/various_payment/list.php
+++ b/htdocs/compta/bank/various_payment/list.php
@@ -67,7 +67,7 @@ $offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortfield) $sortfield = "v.datep,v.rowid";
-if (!$sortorder) $sortorder = "DESC";
+if (!$sortorder) $sortorder="DESC,DESC";
$filtre = GETPOST("filtre", 'alpha');
diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php
index 2034803ecb8..6e0a3a0e195 100644
--- a/htdocs/contact/class/contact.class.php
+++ b/htdocs/contact/class/contact.class.php
@@ -353,9 +353,7 @@ class Contact extends CommonObject
// Clean parameters
$this->lastname = $this->lastname ?trim($this->lastname) : trim($this->name);
$this->firstname = trim($this->firstname);
- if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname = dol_ucwords(dol_strtolower($this->lastname));
- if (!empty($conf->global->MAIN_ALL_TO_UPPER)) $this->lastname = dol_strtoupper($this->lastname);
- if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname = dol_ucwords(dol_strtolower($this->firstname));
+ $this->setUpperOrLowerCase();
if (empty($this->socid)) $this->socid = 0;
if (empty($this->priv)) $this->priv = 0;
if (empty($this->statut)) $this->statut = 0; // This is to convert '' into '0' to avoid bad sql request
@@ -464,10 +462,6 @@ class Contact extends CommonObject
$this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity);
// Clean parameters
- if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname = dol_ucwords(dol_strtolower($this->lastname));
- if (!empty($conf->global->MAIN_ALL_TO_UPPER)) $this->lastname = dol_strtoupper($this->lastname);
- if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname = dol_ucwords(dol_strtolower($this->firstname));
-
$this->lastname = trim($this->lastname) ?trim($this->lastname) : trim($this->lastname);
$this->firstname = trim($this->firstname);
$this->email = trim($this->email);
@@ -478,8 +472,9 @@ class Contact extends CommonObject
$this->skype = trim($this->skype);
$this->photo = trim($this->photo);
$this->fax = trim($this->fax);
- $this->zip = (empty($this->zip) ? '' : $this->zip);
- $this->town = (empty($this->town) ? '' : $this->town);
+ $this->zip = (empty($this->zip) ? '' : trim($this->zip));
+ $this->town = (empty($this->town) ? '' : trim($this->town));
+ $this->setUpperOrLowerCase();
$this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id);
if (empty($this->statut)) $this->statut = 0;
if (empty($this->civility_code) && !is_numeric($this->civility_id)) $this->civility_code = $this->civility_id; // For backward compatibility
diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php
index c1d728eb667..8701c67d711 100644
--- a/htdocs/core/boxes/box_task.php
+++ b/htdocs/core/boxes/box_task.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2015-2019 Frederic France
+/* Copyright (C) 2012-2018 Charlene BENKE
+ * Copyright (C) 2015-2020 Frederic France
*
* 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
@@ -181,7 +181,7 @@ class box_task extends ModeleBoxes
$taskstatic->label = $objp->label;
$taskstatic->progress = $objp->progress;
$taskstatic->fk_statut = $objp->fk_statut;
- $taskstatic->date_end = $objp->datee;
+ $taskstatic->date_end = $this->db->jdate($objp->datee);
$taskstatic->planned_workload = $objp->planned_workload;
$taskstatic->duration_effective = $objp->duration_effective;
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 04b7d4985cd..5371b8078fa 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -569,6 +569,28 @@ abstract class CommonObject
return dol_trunc($ret, $maxlen);
}
+ /**
+ * Set to upper or ucwords/lower if needed
+ *
+ * @return void;
+ */
+ public function setUpperOrLowerCase()
+ {
+ global $conf;
+ if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) {
+ $this->lastname = dol_ucwords(dol_strtolower($this->lastname));
+ $this->firstname = dol_ucwords(dol_strtolower($this->firstname));
+ $this->name = dol_ucwords(dol_strtolower($this->name));
+ }
+ if (!empty($conf->global->MAIN_ALL_TO_UPPER)) {
+ $this->lastname = dol_strtoupper($this->lastname);
+ $this->name = dol_strtoupper($this->name);
+ }
+ if (!empty($conf->global->MAIN_ALL_TOWN_TO_UPPER)) {
+ $this->town = dol_strtoupper($this->town);
+ }
+ }
+
/**
* Return clicable link of object (with eventually picto)
*
@@ -6862,7 +6884,7 @@ abstract class CommonObject
{
$datenotinstring = $this->db->jdate($datenotinstring);
}
- $value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) || $value) ? dol_mktime(GETPOST($keyprefix.'options_'.$key.$keysuffix."hour", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."min", 'int', 3), 0, GETPOST($keyprefix.'options_'.$key.$keysuffix."month", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."day", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."year", 'int', 3)) : $datenotinstring;
+ $value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)) ? dol_mktime(GETPOST($keyprefix.'options_'.$key.$keysuffix."hour", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."min", 'int', 3), 0, GETPOST($keyprefix.'options_'.$key.$keysuffix."month", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."day", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."year", 'int', 3)) : $datenotinstring;
}
// Convert float submited string into real php numeric (value in memory must be a php numeric)
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('price', 'double')))
diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php
index 8af9f7bbc25..976770747c6 100644
--- a/htdocs/core/db/DoliDB.class.php
+++ b/htdocs/core/db/DoliDB.class.php
@@ -237,24 +237,29 @@ abstract class DoliDB implements Database
{
if (!empty($sortfield))
{
- $return = '';
- $fields = explode(',', $sortfield);
- $orders = explode(',', $sortorder);
- $i = 0;
- foreach ($fields as $val)
+ $oldsortorder = '';
+ $return='';
+ $fields=explode(',', $sortfield);
+ $orders=explode(',', $sortorder);
+ $i=0;
+ foreach($fields as $val)
{
if (!$return) $return .= ' ORDER BY ';
else $return .= ', ';
- $return .= preg_replace('/[^0-9a-z_\.]/i', '', $val);
+ $return .= preg_replace('/[^0-9a-z_\.]/i', '', $val); // Add field
$tmpsortorder = trim($orders[$i]);
// Only ASC and DESC values are valid SQL
if (strtoupper($tmpsortorder) === 'ASC') {
+ $oldsortorder = 'ASC';
$return .= ' ASC';
} elseif (strtoupper($tmpsortorder) === 'DESC') {
+ $oldsortorder = 'DESC';
$return .= ' DESC';
+ } else {
+ $return .= ' '.($oldsortorder ? $oldsortorder : 'ASC');
}
$i++;
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index 97539472de2..57446d7163e 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -1628,7 +1628,7 @@ if (!empty($module) && $module != 'initmodule' && $module != 'deletemodule')
$class = 'mod'.$module;
} catch (Throwable $e) { // This is called in PHP 7 only. Never called with PHP 5.6
- $loadclasserrormessage = $e->getMessage()." \n";;
+ $loadclasserrormessage = $e->getMessage()." \n";
$loadclasserrormessage .= 'File: '.$e->getFile()." \n";
$loadclasserrormessage .= 'Line: '.$e->getLine()." \n";
}
@@ -1637,8 +1637,7 @@ if (!empty($module) && $module != 'initmodule' && $module != 'deletemodule')
{
try {
$moduleobj = new $class($db);
- } catch (Exception $e)
- {
+ } catch (Exception $e) {
$error++;
print $e->getMessage();
}
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 5a4469aeab7..656368a8f53 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -71,7 +71,9 @@ class Product extends CommonObject
*/
public $ismultientitymanaged = 1;
-
+ /**
+ * @var string picto
+ */
public $picto = 'product';
/**
@@ -86,6 +88,7 @@ class Product extends CommonObject
* @see label
*/
public $libelle;
+
/**
* Product label
*
@@ -395,7 +398,9 @@ class Product extends CommonObject
*/
public $supplierprices;
-
+ /**
+ * @var array fields of object product
+ */
public $fields = array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
@@ -3190,7 +3195,7 @@ class Product extends CommonObject
* @param string $sql Request to execute
* @param string $mode 'byunit'=number of unit, 'bynumber'=nb of entities
* @param int $year Year (0=current year, -1=all years)
- * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
+ * @return array|int <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
*/
private function _get_stats($sql, $mode, $year = 0)
{
diff --git a/htdocs/product/price.php b/htdocs/product/price.php
index 3c0d28b8614..325fce0ead0 100644
--- a/htdocs/product/price.php
+++ b/htdocs/product/price.php
@@ -470,7 +470,7 @@ if (empty($reshook))
$result = $db->query($sql);
} else {
- setEventMessages(('delete_price_by_qty'.$langs->transnoentities(MissingIds)), null, 'errors');
+ setEventMessages(('delete_price_by_qty'.$langs->transnoentities('MissingIds')), null, 'errors');
}
}
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 3047e986df8..3fcc7e610ac 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -789,8 +789,7 @@ class Societe extends CommonObject
// Clean parameters
if (empty($this->status)) $this->status = 0;
$this->name = $this->name ?trim($this->name) : trim($this->nom);
- if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->name = dol_ucwords(dol_strtolower($this->name));
- if (!empty($conf->global->MAIN_ALL_TO_UPPER)) $this->name = dol_strtoupper($this->name);
+ $this->setUpperOrLowerCase();
$this->nom = $this->name; // For backward compatibility
if (empty($this->client)) $this->client = 0;
if (empty($this->fournisseur)) $this->fournisseur = 0;
@@ -1094,8 +1093,6 @@ class Societe extends CommonObject
$now = dol_now();
- if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->name = dol_ucwords(dol_strtolower($this->name));
- if (!empty($conf->global->MAIN_ALL_TO_UPPER)) $this->name = dol_strtoupper($this->name);
// Clean parameters
$this->id = $id;
$this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity);
@@ -1106,6 +1103,7 @@ class Societe extends CommonObject
$this->address = $this->address ?trim($this->address) : trim($this->address);
$this->zip = $this->zip ?trim($this->zip) : trim($this->zip);
$this->town = $this->town ?trim($this->town) : trim($this->town);
+ $this->setUpperOrLowerCase();
$this->state_id = trim($this->state_id);
$this->country_id = ($this->country_id > 0) ? $this->country_id : 0;
$this->phone = trim($this->phone);
diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php
index c48a0c4be3c..12dd0e1d9b9 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -610,7 +610,7 @@ if (!empty($type))
if ($type == 'f') $label = 'NewSupplier';
}
-if ($contextpage = 'poslist' && $type == 't' && (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))) {
+if ($contextpage == 'poslist' && $type == 't' && (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))) {
print get_htmloutput_mesg(img_warning('default').' '.$langs->trans("BecarefullChangeThirdpartyBeforeAddProductToInvoice"), '', 'warning', 1);
}
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index ee18a60104c..3be02e6f8c6 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -1125,6 +1125,7 @@ class User extends CommonObject
global $mysoc;
// Clean parameters
+<<<<<<< HEAD
if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) {
$this->lastname = dol_ucwords(dol_strtolower($this->lastname));
@@ -1136,6 +1137,9 @@ class User extends CommonObject
$this->firstname = dol_ucwords(dol_strtolower($this->firstname));
}
+=======
+ $this->setUpperOrLowerCase();
+>>>>>>> upstream/develop
$this->login = trim($this->login);
if (!isset($this->entity)) {
$this->entity = $conf->entity; // If not defined, we use default value
@@ -1472,6 +1476,7 @@ class User extends CommonObject
dol_syslog(get_class($this)."::update notrigger=".$notrigger.", nosyncmember=".$nosyncmember.", nosyncmemberpass=".$nosyncmemberpass);
// Clean parameters
+<<<<<<< HEAD
if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) {
$this->lastname = dol_ucwords(dol_strtolower($this->lastname));
@@ -1483,6 +1488,8 @@ class User extends CommonObject
$this->firstname = dol_ucwords(dol_strtolower($this->firstname));
}
+=======
+>>>>>>> upstream/develop
$this->lastname = trim($this->lastname);
$this->firstname = trim($this->firstname);
$this->employee = $this->employee ? $this->employee : 0;
@@ -1490,9 +1497,10 @@ class User extends CommonObject
$this->gender = trim($this->gender);
$this->pass = trim($this->pass);
$this->api_key = trim($this->api_key);
- $this->address = $this->address ?trim($this->address) : trim($this->address);
- $this->zip = $this->zip ?trim($this->zip) : trim($this->zip);
- $this->town = $this->town ?trim($this->town) : trim($this->town);
+ $this->address = $this->address ? trim($this->address) : trim($this->address);
+ $this->zip = $this->zip ? trim($this->zip) : trim($this->zip);
+ $this->town = $this->town ? trim($this->town) : trim($this->town);
+ $this->setUpperOrLowerCase();
$this->state_id = trim($this->state_id);
$this->country_id = ($this->country_id > 0) ? $this->country_id : 0;
$this->office_phone = trim($this->office_phone);
|