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

Conflicts:
	htdocs/adherents/class/adherent.class.php
	htdocs/filefunc.inc.php
This commit is contained in:
Laurent Destailleur 2020-03-04 19:28:15 +01:00
commit a6d340a22c
9 changed files with 174 additions and 19 deletions

View File

@ -2,6 +2,69 @@
English Dolibarr ChangeLog
--------------------------------------------------------------
***** ChangeLog for 11.0.2 compared to 11.0.1 *****
FIX: #10309
FIX: #13110
FIX: #13118
FIX: #13124
FIX: #13131
FIX: #13135
FIX: #13146 #13198
FIX: #13175
FIX: #13182
FIX: #13183
FIX: #13184
FIX: #13263
FIX: #13267
FIX: an external user can not approve
FIX: API Get list of documents for supplier_invoice
FIX: API to push an expense report
FIX: API upload/download doc for expensereport
FIX: Avoid to download the export if we just press enter to refresh form
FIX: Bad link to template invoices
FIX: Bad sort link in accounting report
FIX: Bad translation for productlot EatBy and SellBy
FIX: better method to check user rights AND usergroup rights !
FIX: CA by product list filter
FIX: CSS
FIX: Disable js if no javascript
FIX: duplicate class name into some log lines
FIX: etrafield with visibilty=5 were not in read only.
FIX: excess paid from situation invoices not counted when calculating remain to pay.
FIX: Force FEC export to txt format.
FIX: Free input for email no more visible.
FIX: Keep assigned users in session when loading projects and tasks
FIX: List of viewed projects too large in task widget.
FIX: Menu truncated. Add tooltip to have all content.
FIX: Missing field "billed" in export.
FIX: missing "statut" for getNomUrl() function
FIX: modFournisseur is required by modSupplierProposal
FIX: Multicompany compatibility
FIX: must be == and not =
FIX: option for topbar search and bookmarks
FIX: option MAIN_OPTIMIZEFORTEXTBROWSER
FIX: some responsive troubles
FIX: round MT in accountancy books
FIX: search with '0'
FIX: sort link
FIX: SQL Overload in default contact trigger.
FIX: SQl syntax error.
FIX: Submit of documents for supplier invoices.
FIX: timezone must be tzserver and not tzuser as on contract card
FIX: token in barcode tools page missing
FIX: Bad name of trigger PROPAL_SUPPLIER_TRIGGER, should be PROPOSAL_SUPPLIER_TRIGGER
FIX: Type of contact for event does not exists and not supported
FIX: Type of contact not saved when creating a contact
FIX: typo on ckeck method
FIX: undefined function measuringUnitString in product list
FIX: Usage of project not available in export.
FIX: wrong test
FIX: z-index for moretabsList with constant MAIN_MAXTABS_IN_CARD
FIX: Use GETPOST instead of POST
FIX: HTML Injection
FIX: Visualization rights correction on last modified contacts box.
FIX: Vulnerability in module from modulebuilder.
FIX: Vulnerability reported by code16
***** ChangeLog for 12.0.0 compared to 11.0.0 *****
For Users:

View File

@ -1356,7 +1356,7 @@ class Adherent extends CommonObject
require_once DOL_DOCUMENT_ROOT . '/adherents/class/subscription.class.php';
$sql = "SELECT c.rowid, c.fk_adherent, c.subscription, c.note, c.fk_bank,";
$sql = "SELECT c.rowid, c.fk_adherent, c.fk_type, c.subscription, c.note, c.fk_bank,";
$sql .= " c.tms as datem,";
$sql .= " c.datec as datec,";
$sql .= " c.dateadh as dateh,";
@ -1386,6 +1386,7 @@ class Adherent extends CommonObject
$subscription = new Subscription($this->db);
$subscription->id = $obj->rowid;
$subscription->fk_adherent = $obj->fk_adherent;
$subscription->fk_type = $obj->fk_type;
$subscription->amount = $obj->subscription;
$subscription->note = $obj->note;
$subscription->fk_bank = $obj->fk_bank;

View File

@ -691,11 +691,11 @@ if ($massaction == 'confirm_createbills') // Create bills from orders
for ($i = 0; $i < $num; $i++)
{
$desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle);
$desc = ($lines[$i]->desc ? $lines[$i]->desc : '');
// If we build one invoice for several order, we must put the invoice of order on the line
if (!empty($createbills_onebythird))
{
$desc = dol_concatdesc($desc, $langs->trans("Order").' '.$cmd->ref.' - '.dol_print_date($cmd->date, 'day', $langs));
$desc = dol_concatdesc($desc, $langs->trans("Order").' '.$cmd->ref.' - '.dol_print_date($cmd->date, 'day'));
}
if ($lines[$i]->subprice < 0)

View File

@ -46,6 +46,7 @@ if (!defined('USE_CUSTOME_REPORT_AS_INCLUDE'))
$search_filters = GETPOST('search_filters', 'array');
$search_measures = GETPOST('search_measures', 'array');
$search_xaxis = GETPOST('search_xaxis', 'array');
$search_groupby = GETPOST('search_groupby', 'array');
$search_yaxis = GETPOST('search_yaxis', 'array');
$search_graph = GETPOST('search_graph', 'none');
@ -173,6 +174,10 @@ if ($action == 'viewgraph') {
setEventMessages($langs->trans("OnlyOneFieldForXAxisIsPossible"), null, 'warnings');
$search_xaxis = array(0 => $search_xaxis[0]);
}
if (count($search_groupby) >= 2) {
setEventMessages($langs->trans("OnlyOneFieldForGroupByIsPossible"), null, 'warnings');
$search_groupby = array(0 => $search_groupb[0]);
}
if (!count($search_xaxis)) {
setEventMessages($langs->trans("AtLeastOneXAxisIsRequired"), null, 'warnings');
} elseif ($mode == 'graph' && $search_graph == 'bars' && count($search_measures) > 3) {
@ -191,7 +196,9 @@ $param = '';
$arrayofmesures = array('t.count'=>'Count');
$arrayofxaxis = array();
$arrayofgroupby = array();
$arrayofyaxis = array();
$arrayofvaluesforgroupby = array();
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -256,6 +263,46 @@ print '<div class="inline-block opacitymedium"><span class="fas fa-chart-line pa
print $form->multiselectarray('search_measures', $arrayofmesures, $search_measures, 0, 0, 'minwidth500', 1);
print '</div>';
// Group by
print '<div class="divadvancedsearchfield">';
foreach ($object->fields as $key => $val) {
if (!$val['measure']) {
if (in_array($key, array(
'id', 'ref_int', 'ref_ext', 'rowid', 'entity', 'last_main_doc', 'logo', 'logo_squarred', 'extraparams',
'parent', 'photo', 'socialnetworks', 'webservices_url', 'webservices_key'))) continue;
if (isset($val['enabled']) && !dol_eval($val['enabled'], 1)) continue;
if (isset($val['visible']) && !dol_eval($val['visible'], 1)) continue;
if (preg_match('/^fk_/', $key) && !preg_match('/^fk_statu/', $key)) continue;
if (preg_match('/^pass/', $key)) continue;
if (in_array($val['type'], array('html', 'text'))) continue;
if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) {
$arrayofgroupby['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Year").')', 'position' => $val['position'].'-y');
$arrayofgroupby['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Month").')', 'position' => $val['position'].'-m');
$arrayofgroupby['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Day").')', 'position' => $val['position'].'-d');
} else {
$arrayofgroupby['t.'.$key] = array('label' => $val['label'], 'position' => (int) $val['position']);
}
}
// Add measure from extrafields
if ($object->isextrafieldmanaged) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') continue;
$arrayofgroupby['te.'.$key] = array('label' => $extrafields->attributes[$object->table_element]['label'][$key], 'position' => (int) $extrafields->attributes[$object->table_element]['pos'][$key]);
}
}
}
$arrayofgroupby = dol_sort_array($arrayofgroupby, 'position', 'asc', 1);
$arrayofgroupbylabel = array();
foreach ($arrayofgroupby as $key => $val) {
$arrayofgroupbylabel[$key] = $val['label'];
}
print '<div class="inline-block opacitymedium"><span class="fas fa-ruler-horizontal paddingright" title="'.$langs->trans("GroupBy").'"></span>'.$langs->trans("GroupBy").'</div> ';
print $form->multiselectarray('search_groupby', $arrayofgroupbylabel, $search_groupby, 0, 0, 'minwidth250', 1);
print '</div>';
// XAxis
print '<div class="divadvancedsearchfield">';
foreach ($object->fields as $key => $val) {
@ -279,7 +326,8 @@ foreach ($object->fields as $key => $val) {
// Add measure from extrafields
if ($object->isextrafieldmanaged) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$arrayofxaxis['te.'.$key] = array('label' => $extrafields->attributes[$object->table_element]['label'][$key], 'position' => (int) $extrafields->attributes[$object->table_element]['pos'][$key]);
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') continue;
$arrayofxaxis['te.'.$key] = array('label' => $extrafields->attributes[$object->table_element]['label'][$key], 'position' => (int) $extrafields->attributes[$object->table_element]['pos'][$key]);
}
}
}
@ -290,7 +338,7 @@ foreach ($arrayofxaxis as $key => $val) {
$arrayofxaxislabel[$key] = $val['label'];
}
print '<div class="inline-block opacitymedium"><span class="fas fa-ruler-horizontal paddingright" title="'.$langs->trans("XAxis").'"></span>'.$langs->trans("XAxis").'</div> ';
print $form->multiselectarray('search_xaxis', $arrayofxaxislabel, $search_xaxis, 0, 0, 'minwidth500', 1);
print $form->multiselectarray('search_xaxis', $arrayofxaxislabel, $search_xaxis, 0, 0, 'minwidth250', 1);
print '</div>';
// YAxis
@ -342,6 +390,19 @@ print '</div>';
print '</form>';
// Get all possible values of fields when a group by is set
if (is_array($search_groupby) && count($search_groupby)) {
$sql = 'SELECT DISTINCT '.$search_groupby[0].' as val FROM '.MAIN_DB_PREFIX.$object->table_element.' as t';
$resql = $db->query($sql);
if (!$resql) {
dol_print_error($db);
}
while ($obj = $db->fetch_object($resql)) {
$arrayofvaluesforgroupby[$obj->val] = $obj->val;
}
}
// Generate the SQL request
$sql = '';
if (!empty($search_measures) && !empty($search_xaxis))
@ -362,6 +423,19 @@ if (!empty($search_measures) && !empty($search_xaxis))
}
else $sql .= $val.' as x_'.$key.', ';
}
foreach ($search_groupby as $key => $val) {
if (preg_match('/\-year$/', $val)) {
$tmpval = preg_replace('/\-year$/', '', $val);
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y'), ";
} elseif (preg_match('/\-month$/', $val)) {
$tmpval = preg_replace('/\-month$/', '', $val);
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y-%m'), ";
} elseif (preg_match('/\-day$/', $val)) {
$tmpval = preg_replace('/\-day$/', '', $val);
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y-%m-%d'), ";
}
else $sql .= $val.', ';
}
foreach ($search_measures as $key => $val) {
if ($val == 't.count') $sql .= 'COUNT(t.'.$fieldid.') as y_'.$key.', ';
elseif (preg_match('/\-sum$/', $val)) {
@ -417,6 +491,19 @@ if (!empty($search_measures) && !empty($search_xaxis))
}
else $sql .= $val.', ';
}
foreach ($search_groupby as $key => $val) {
if (preg_match('/\-year$/', $val)) {
$tmpval = preg_replace('/\-year$/', '', $val);
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y'), ";
} elseif (preg_match('/\-month$/', $val)) {
$tmpval = preg_replace('/\-month$/', '', $val);
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y-%m'), ";
} elseif (preg_match('/\-day$/', $val)) {
$tmpval = preg_replace('/\-day$/', '', $val);
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y-%m-%d'), ";
}
else $sql .= $val.', ';
}
$sql = preg_replace('/,\s*$/', '', $sql);
$sql .= ' ORDER BY ';
foreach ($search_xaxis as $key => $val) {
@ -482,7 +569,7 @@ if ($mode == 'grid') {
if ($mode == 'graph') {
$WIDTH = '80%';
$HEIGHT = 200;
var_dump($data);
// Show graph
$px1 = new DolGraph();
$mesg = $px1->isGraphKo();

View File

@ -1883,6 +1883,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'tzserver', $outputlang
$format = str_replace('%A', '__A__', $format);
}
// Analyze date
$reg = array();
if (preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', $time, $reg)) // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000

View File

@ -1015,7 +1015,9 @@ class ExpenseReport extends CommonObject
public function fetch_lines()
{
// phpcs:enable
$this->lines = array();
global $conf;
$this->lines = array();
$sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date, de.rang,';
$sql .= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_c_exp_tax_cat, de.fk_projet as fk_project, de.tva_tx, de.fk_ecm_files,';

View File

@ -31,7 +31,7 @@
*/
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE', 'Dolibarr');
if (! defined('DOL_VERSION')) define('DOL_VERSION', '12.0.0-alpha'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
if (! defined('DOL_VERSION')) define('DOL_VERSION', '11.0.2'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
if (! defined('EURO')) define('EURO', chr(128));

View File

@ -809,16 +809,6 @@ if ($object->id > 0)
}
}
if ($user->rights->fournisseur->facture->creer)
{
$langs->load("bills");
if ($object->status == 1) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a>';
} else {
print '<a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyIsClosed")).'" href="#">'.$langs->trans("AddBill").'</a>';
}
}
if ($user->rights->fournisseur->facture->creer)
{
if (!empty($orders2invoice) && $orders2invoice > 0)
@ -836,6 +826,16 @@ if ($object->id > 0)
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NoOrdersToInvoice").' ('.$langs->trans("WithReceptionFinished").')').'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
}
if ($user->rights->fournisseur->facture->creer)
{
$langs->load("bills");
if ($object->status == 1) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a>';
} else {
print '<a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyIsClosed")).'" href="#">'.$langs->trans("AddBill").'</a>';
}
}
// Add action
if (!empty($conf->agenda->enabled) && !empty($conf->global->MAIN_REPEATTASKONEACHTAB) && $object->status == 1)
{

View File

@ -19,7 +19,7 @@
/**
* \file htdocs/projet/contact.php
* \ingroup project
* \brief Onglet de gestion des contacts du projet
* \brief List of all contacts of a project
*/
require '../main.inc.php';
@ -27,6 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
if ($conf->categorie->enabled) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; }
// Load translation files required by the page
$langs->loadLangs(array('projects', 'companies'));