Merge branch '8.0' into 8.0_fix9964

This commit is contained in:
Laurent Destailleur 2018-12-14 19:37:40 +01:00 committed by GitHub
commit 063e589a1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 64 additions and 37 deletions

View File

@ -621,7 +621,6 @@ if ($num > 0)
$object->id = $line->id; $object->id = $line->id;
$object->piece_num = $line->piece_num; $object->piece_num = $line->piece_num;
print $object->getNomUrl(1,'',0,'',1); print $object->getNomUrl(1,'',0,'',1);
//print '<a href="./card.php?piece_num=' . $line->piece_num . '&save_lastsearch_values=1">' . $line->piece_num . '</a>';
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }

View File

@ -561,12 +561,11 @@ if (! empty($conf->global->MAIN_FEATURES_LEVEL))
print load_fiche_titre($langs->trans("VATBalance"), '', ''); // need to add translation print load_fiche_titre($langs->trans("VATBalance"), '', ''); // need to add translation
$sql1 = "SELECT SUM(amount) as mm, date_format(f.datev,'%Y') as dm"; $sql1 = "SELECT SUM(amount) as mm";
$sql1 .= " FROM " . MAIN_DB_PREFIX . "tva as f"; $sql1 .= " FROM " . MAIN_DB_PREFIX . "tva as f";
$sql1 .= " WHERE f.entity = " . $conf->entity; $sql1 .= " WHERE f.entity = " . $conf->entity;
$sql1 .= " AND f.datev >= '" . $db->idate($date_start) . "'"; $sql1 .= " AND f.datev >= '" . $db->idate($date_start) . "'";
$sql1 .= " AND f.datev <= '" . $db->idate($date_end) . "'"; $sql1 .= " AND f.datev <= '" . $db->idate($date_end) . "'";
$sql1 .= " GROUP BY dm ORDER BY dm ASC";
$result = $db->query($sql1); $result = $db->query($sql1);
if ($result) { if ($result) {

View File

@ -1910,26 +1910,35 @@ class ExtraFields
/** /**
* return array_options array of data of extrafields value of object sent by a search form * return array_options array of data of extrafields value of object sent by a search form
* *
* @param array $extralabels $array of extrafields (@deprecated) * @param array|string $extrafieldsobjectkey array of extrafields (old usage) or value of object->table_element (new usage)
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names) * @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names) * @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
* @return array|int array_options set or 0 if no value * @return array|int array_options set or 0 if no value
*/ */
function getOptionalsFromPost($extralabels,$keyprefix='',$keysuffix='') function getOptionalsFromPost($extrafieldsobjectkey, $keyprefix='', $keysuffix='')
{ {
global $_POST; global $_POST;
if (is_array($this->attributes[$object->table_element]['label'])) $extralabels=$this->attributes[$object->table_element]['label']; if (is_string($extrafieldsobjectkey) && is_array($this->attributes[$extrafieldsobjectkey]['label']))
{
$extralabels = $this->attributes[$extrafieldsobjectkey]['label'];
}
else
{
$extralabels = $extrafieldsobjectkey;
}
$array_options = array();
if (is_array($extralabels)) if (is_array($extralabels))
{ {
$array_options = array();
// Get extra fields // Get extra fields
foreach ($extralabels as $key => $value) foreach ($extralabels as $key => $value)
{ {
$key_type=$this->attribute_type[$key]; $key_type = '';
if (! empty($object->table_element) && is_array($this->attributes) && array_key_exists($object->table_element, $this->attributes)) { if (is_string($extrafieldsobjectkey))
$key_type=$this->attributes[$object->table_element]['type'][$key]; {
$key_type = $this->attributes[$extrafieldsobjectkey]['type'][$key];
} }
if (in_array($key_type,array('date','datetime'))) if (in_array($key_type,array('date','datetime')))
@ -1959,8 +1968,7 @@ class ExtraFields
return $array_options; return $array_options;
} }
else {
return 0; return 0;
} }
}
} }

View File

@ -321,13 +321,18 @@ function GETPOST($paramname, $check='none', $method=0, $filter=null, $options=nu
} }
} }
} }
if (! empty($_SESSION['lastsearch_contextpage_'.$relativepathstring])) // If there is saved contextpage // If there is saved contextpage, page or limit
{ if ($paramname == 'contextpage' && ! empty($_SESSION['lastsearch_contextpage_'.$relativepathstring]))
if ($paramname == 'contextpage')
{ {
$out = $_SESSION['lastsearch_contextpage_'.$relativepathstring]; $out = $_SESSION['lastsearch_contextpage_'.$relativepathstring];
//var_dump($paramname.' '.$out);
} }
elseif ($paramname == 'page' && ! empty($_SESSION['lastsearch_page_'.$relativepathstring]))
{
$out = $_SESSION['lastsearch_page_'.$relativepathstring];
}
elseif ($paramname == 'limit' && ! empty($_SESSION['lastsearch_limit_'.$relativepathstring]))
{
$out = $_SESSION['lastsearch_limit_'.$relativepathstring];
} }
} }
// Else, retreive default values if we are not doing a sort // Else, retreive default values if we are not doing a sort

View File

@ -477,14 +477,11 @@ class modSociete extends DolibarrModules
$this->import_tables_array[$r]=array('sr'=>MAIN_DB_PREFIX.'societe_rib'); $this->import_tables_array[$r]=array('sr'=>MAIN_DB_PREFIX.'societe_rib');
$this->import_fields_array[$r]=array('sr.fk_soc'=>"ThirdPartyName*",'sr.bank'=>"Bank", $this->import_fields_array[$r]=array('sr.fk_soc'=>"ThirdPartyName*",'sr.bank'=>"Bank",
'sr.code_banque'=>"BankCode",'sr.code_guichet'=>"DeskCode",'sr.number'=>"BankAccountNumber*", 'sr.code_banque'=>"BankCode",'sr.code_guichet'=>"DeskCode",'sr.number'=>"BankAccountNumber*",
'sr.cle_rib'=>"BankAccountNumberKey",'sr.bic'=>"BIC",'sr.iban_prefix'=>"IBAN", 'sr.domiciliation'=>"BankAccountDomiciliation",'sr.proprio' => "BankAccountOwner", 'sr.owner_address' => "BankAccountOwnerAddress", 'sr.default_rib' => 'Default', 'sr.cle_rib'=>"BankAccountNumberKey",'sr.bic'=>"BIC",'sr.iban_prefix'=>"IBAN", 'sr.domiciliation'=>"BankAccountDomiciliation",'sr.proprio' => "BankAccountOwner", 'sr.owner_address' => "BankAccountOwnerAddress", 'sr.default_rib' => 'Default'
'sr.fk_departement'=>"StateId",'sr.fk_pays'=>"CountryCode"
); );
$this->import_convertvalue_array[$r]=array( $this->import_convertvalue_array[$r]=array(
'sr.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty'), 'sr.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty')
'sr.fk_departement'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/cstate.class.php','class'=>'Cstate','method'=>'fetch','dict'=>'DictionaryState'),
'sr.fk_pays'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/ccountry.class.php','class'=>'Ccountry','method'=>'fetch','dict'=>'DictionaryCountry'),
); );
$this->import_examplevalues_array[$r]=array('sr.fk_soc'=>"MyBigCompany",'sr.bank'=>"ING", $this->import_examplevalues_array[$r]=array('sr.fk_soc'=>"MyBigCompany",'sr.bank'=>"ING",
'sr.code_banque'=>"0000", 'sr.code_guichet'=>"1111",'sr.number'=>"3333333333", 'sr.code_banque'=>"0000", 'sr.code_guichet'=>"1111",'sr.number'=>"3333333333",

View File

@ -3035,10 +3035,10 @@ class SupplierInvoiceLine extends CommonObjectLine
$sql.= " ".$this->product_type.","; $sql.= " ".$this->product_type.",";
$sql.= " ".price2num($this->remise_percent).","; $sql.= " ".price2num($this->remise_percent).",";
$sql.= " ".price2num($this->subprice).","; $sql.= " ".price2num($this->subprice).",";
$sql.= " ".price2num($this->total_ttc/$this->qty).","; $sql.= " ".(! empty($this->qty)?price2num($this->total_ttc / $this->qty):price2num($this->total_ttc)).",";
$sql.= " ".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null").","; $sql.= " ".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null").",";
$sql.= " ".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null").","; $sql.= " ".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null").",";
$sql.= ' '.(!empty($this->fk_code_ventilation)?$this->fk_code_ventilation:0).','; $sql.= ' '.(! empty($this->fk_code_ventilation)?$this->fk_code_ventilation:0).',';
$sql.= ' '.$this->rang.','; $sql.= ' '.$this->rang.',';
$sql.= ' '.$this->special_code.','; $sql.= ' '.$this->special_code.',';
$sql.= " '".$this->db->escape($this->info_bits)."',"; $sql.= " '".$this->db->escape($this->info_bits)."',";

View File

@ -1,6 +1,6 @@
# Dolibarr language file - Source file is en_US - banks # Dolibarr language file - Source file is en_US - banks
Bank=Banco Bank=Banco
MenuBankCash=Bank | Cash MenuBankCash=Bancos | Cajas
MenuVariousPayment=Pagos varios MenuVariousPayment=Pagos varios
MenuNewVariousPayment=Nuevo pago varios MenuNewVariousPayment=Nuevo pago varios
BankName=Nombre del banco BankName=Nombre del banco

View File

@ -723,18 +723,27 @@ if (! defined('NOLOGIN'))
$relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
//var_dump($relativepathstring); //var_dump($relativepathstring);
// We click on a link that leave a page we have to save search criteria. We save them from tmp to no tmp // We click on a link that leave a page we have to save search criteria, contextpage, limit and page. We save them from tmp to no tmp
if (! empty($_SESSION['lastsearch_values_tmp_'.$relativepathstring])) if (! empty($_SESSION['lastsearch_values_tmp_'.$relativepathstring]))
{ {
$_SESSION['lastsearch_values_'.$relativepathstring]=$_SESSION['lastsearch_values_tmp_'.$relativepathstring]; $_SESSION['lastsearch_values_'.$relativepathstring]=$_SESSION['lastsearch_values_tmp_'.$relativepathstring];
unset($_SESSION['lastsearch_values_tmp_'.$relativepathstring]); unset($_SESSION['lastsearch_values_tmp_'.$relativepathstring]);
} }
// We also save contextpage
if (! empty($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring])) if (! empty($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]))
{ {
$_SESSION['lastsearch_contextpage_'.$relativepathstring]=$_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]; $_SESSION['lastsearch_contextpage_'.$relativepathstring]=$_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring];
unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]); unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]);
} }
if (! empty($_SESSION['lastsearch_page_tmp_'.$relativepathstring]) && $_SESSION['lastsearch_page_tmp_'.$relativepathstring] > 1)
{
$_SESSION['lastsearch_page_'.$relativepathstring]=$_SESSION['lastsearch_page_tmp_'.$relativepathstring];
unset($_SESSION['lastsearch_page_tmp_'.$relativepathstring]);
}
if (! empty($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]) && $_SESSION['lastsearch_limit_tmp_'.$relativepathstring] != $conf->liste_limit)
{
$_SESSION['lastsearch_limit_'.$relativepathstring]=$_SESSION['lastsearch_limit_tmp_'.$relativepathstring];
unset($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]);
}
} }
$action = ''; $action = '';
@ -1951,7 +1960,8 @@ if (! function_exists("llxFooter"))
function llxFooter($comment='',$zone='private', $disabledoutputofmessages=0) function llxFooter($comment='',$zone='private', $disabledoutputofmessages=0)
{ {
global $conf, $langs, $user, $object; global $conf, $langs, $user, $object;
global $delayedhtmlcontent, $contextpage; global $delayedhtmlcontent;
global $contextpage, $page, $limit;
$ext='layout='.$conf->browser->layout.'&version='.urlencode(DOL_VERSION); $ext='layout='.$conf->browser->layout.'&version='.urlencode(DOL_VERSION);
@ -1986,8 +1996,16 @@ if (! function_exists("llxFooter"))
if (preg_match('/list\.php$/', $relativepathstring)) if (preg_match('/list\.php$/', $relativepathstring))
{ {
unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]); unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]);
unset($_SESSION['lastsearch_page_tmp_'.$relativepathstring]);
unset($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]);
if (! empty($contextpage)) $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]=$contextpage; if (! empty($contextpage)) $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]=$contextpage;
if (! empty($page) && $page > 1) $_SESSION['lastsearch_page_tmp_'.$relativepathstring]=$page;
if (! empty($limit) && $limit != $conf->limit) $_SESSION['lastsearch_limit_tmp_'.$relativepathstring]=$limit;
unset($_SESSION['lastsearch_contextpage_'.$relativepathstring]); unset($_SESSION['lastsearch_contextpage_'.$relativepathstring]);
unset($_SESSION['lastsearch_page_'.$relativepathstring]);
unset($_SESSION['lastsearch_limit_'.$relativepathstring]);
} }
// Core error message // Core error message

View File

@ -6,7 +6,7 @@
* Copyright (C) 2005-2018 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2018 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-2018 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015-2017 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015-2017 Jean-François Ferry <jfefe@aternatik.fr>
@ -152,7 +152,7 @@ if (empty($reshook)) {
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans("ErrorUserCannotBeDelete"), null, 'errors'); setEventMessages($langs->trans("ErrorUserCannotBeDelete"), null, 'errors');
} else { } else {
header("Location: index.php?restore_lastsearch_values=1"); header("Location: ".DOL_URL_ROOT."/user/list.php?restore_lastsearch_values=1");
exit; exit;
} }
} }

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com> * Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
* Copyright (C) 2012 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2012 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018 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
* 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
@ -110,7 +111,7 @@ if (empty($reshook)) {
{ {
$object->fetch($id); $object->fetch($id);
$object->delete(); $object->delete();
header("Location: index.php?restore_lastsearch_values=1"); header("Location: ".DOL_URL_ROOT."/user/group/list.php?restore_lastsearch_values=1");
exit; exit;
} }
else else