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

This commit is contained in:
Laurent Destailleur 2020-10-29 13:10:39 +01:00
commit c187b41714
4 changed files with 25 additions and 14 deletions

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

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

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