Merge remote-tracking branch 'upstream/develop' into zapieruser

This commit is contained in:
Frédéric FRANCE 2020-10-29 18:41:22 +01:00
commit 317ffc65c9
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
13 changed files with 78 additions and 42 deletions

View File

@ -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);

View File

@ -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 '<tr><td>'.$langs->trans("SubledgerAccount").'</td>';
print '<tr><td>'.$langs->trans("SubledgerAccount").'aaaa</td>';
print '<td>';
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
{

View File

@ -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');

View File

@ -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

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2012-2018 Charlene BENKE <charlie@patas-monkey.com>
* Copyright (C) 2015-2019 Frederic France <frederic.france@netlogic.fr>
/* Copyright (C) 2012-2018 Charlene BENKE <charlie@patas-monkey.com>
* Copyright (C) 2015-2020 Frederic France <frederic.france@netlogic.fr>
*
* 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;

View File

@ -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')))

View File

@ -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++;

View File

@ -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()."<br>\n";;
$loadclasserrormessage = $e->getMessage()."<br>\n";
$loadclasserrormessage .= 'File: '.$e->getFile()."<br>\n";
$loadclasserrormessage .= 'Line: '.$e->getLine()."<br>\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();
}

View File

@ -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)
{

View File

@ -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');
}
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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);