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

develop

Conflicts:
	htdocs/core/class/html.form.class.php
This commit is contained in:
Laurent Destailleur 2020-01-10 14:31:37 +01:00
commit 22d4f37e58
15 changed files with 347 additions and 278 deletions

View File

@ -3,10 +3,11 @@ FROM php:7.2-apache
ENV HOST_USER_ID 33 ENV HOST_USER_ID 33
ENV PHP_INI_DATE_TIMEZONE 'UTC' ENV PHP_INI_DATE_TIMEZONE 'UTC'
RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libldap2-dev zlib1g-dev libicu-dev g++\ RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libldap2-dev libzip-dev zlib1g-dev libicu-dev g++\
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \ && docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
&& docker-php-ext-install gd \ && docker-php-ext-install gd \
&& docker-php-ext-install zip \
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \ && docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \
&& docker-php-ext-install ldap \ && docker-php-ext-install ldap \
&& docker-php-ext-install mysqli \ && docker-php-ext-install mysqli \

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2016-2018 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2016-2018 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -41,6 +41,7 @@ $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'acc
$search_account = GETPOST('search_account', 'alpha'); $search_account = GETPOST('search_account', 'alpha');
$search_label = GETPOST('search_label', 'alpha'); $search_label = GETPOST('search_label', 'alpha');
$search_labelshort = GETPOST('search_labelshort', 'alpha');
$search_accountparent = GETPOST('search_accountparent', 'alpha'); $search_accountparent = GETPOST('search_accountparent', 'alpha');
$search_pcgtype = GETPOST('search_pcgtype', 'alpha'); $search_pcgtype = GETPOST('search_pcgtype', 'alpha');
$search_pcgsubtype = GETPOST('search_pcgsubtype', 'alpha'); $search_pcgsubtype = GETPOST('search_pcgsubtype', 'alpha');
@ -64,6 +65,7 @@ if (!$sortorder) $sortorder = "ASC";
$arrayfields = array( $arrayfields = array(
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1), 'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1), 'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
'aa.labelshort'=>array('label'=>$langs->trans("LabelToShow"), 'checked'=>1),
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>1), 'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>1),
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'), 'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'),
'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'), 'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'),
@ -95,6 +97,7 @@ if (empty($reshook))
{ {
$search_account = ""; $search_account = "";
$search_label = ""; $search_label = "";
$search_labelshort = "";
$search_accountparent = ""; $search_accountparent = "";
$search_pcgtype = ""; $search_pcgtype = "";
$search_pcgsubtype = ""; $search_pcgsubtype = "";
@ -190,7 +193,7 @@ if ($action == 'delete') {
$pcgver = $conf->global->CHARTOFACCOUNTS; $pcgver = $conf->global->CHARTOFACCOUNTS;
$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.account_number, aa.account_parent , aa.label, aa.active, "; $sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.account_number, aa.account_parent , aa.label, aa.labelshort, aa.active, ";
$sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2"; $sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version AND aa.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version AND aa.entity = ".$conf->entity;
@ -200,6 +203,7 @@ $sql .= " WHERE asy.rowid = ".$pcgver;
//print $sql; //print $sql;
if (strlen(trim($search_account))) $sql .= natural_search("aa.account_number", $search_account); if (strlen(trim($search_account))) $sql .= natural_search("aa.account_number", $search_account);
if (strlen(trim($search_label))) $sql .= natural_search("aa.label", $search_label); if (strlen(trim($search_label))) $sql .= natural_search("aa.label", $search_label);
if (strlen(trim($search_labelshort))) $sql .= natural_search("aa.labelshort", $search_labelshort);
if (strlen(trim($search_accountparent))) $sql .= natural_search("aa.account_parent", $search_accountparent); if (strlen(trim($search_accountparent))) $sql .= natural_search("aa.account_parent", $search_accountparent);
if (strlen(trim($search_pcgtype))) $sql .= natural_search("aa.pcg_type", $search_pcgtype); if (strlen(trim($search_pcgtype))) $sql .= natural_search("aa.pcg_type", $search_pcgtype);
if (strlen(trim($search_pcgsubtype))) $sql .= natural_search("aa.pcg_subtype", $search_pcgsubtype); if (strlen(trim($search_pcgsubtype))) $sql .= natural_search("aa.pcg_subtype", $search_pcgsubtype);
@ -232,6 +236,7 @@ if ($resql)
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
if ($search_account) $param .= '&search_account='.urlencode($search_account); if ($search_account) $param .= '&search_account='.urlencode($search_account);
if ($search_label) $param .= '&search_label='.urlencode($search_label); if ($search_label) $param .= '&search_label='.urlencode($search_label);
if ($search_labelshort) $param.= '&search_labelshort='.urlencode($search_labelshort);
if ($search_accountparent) $param .= '&search_accountparent='.urlencode($search_accountparent); if ($search_accountparent) $param .= '&search_accountparent='.urlencode($search_accountparent);
if ($search_pcgtype) $param .= '&search_pcgtype='.urlencode($search_pcgtype); if ($search_pcgtype) $param .= '&search_pcgtype='.urlencode($search_pcgtype);
if ($search_pcgsubtype) $param .= '&search_pcgsubtype='.urlencode($search_pcgsubtype); if ($search_pcgsubtype) $param .= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
@ -316,6 +321,7 @@ if ($resql)
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
if (!empty($arrayfields['aa.account_number']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_account" value="'.$search_account.'"></td>'; if (!empty($arrayfields['aa.account_number']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_account" value="'.$search_account.'"></td>';
if (!empty($arrayfields['aa.label']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="'.$search_label.'"></td>'; if (!empty($arrayfields['aa.label']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="'.$search_label.'"></td>';
if (!empty($arrayfields['aa.labelshort']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_labelshort" value="' . $search_labelshort . '"></td>';
if (!empty($arrayfields['aa.account_parent']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_accountparent" value="'.$search_accountparent.'"></td>'; if (!empty($arrayfields['aa.account_parent']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_accountparent" value="'.$search_accountparent.'"></td>';
if (!empty($arrayfields['aa.pcg_type']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgtype" value="'.$search_pcgtype.'"></td>'; if (!empty($arrayfields['aa.pcg_type']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgtype" value="'.$search_pcgtype.'"></td>';
if (!empty($arrayfields['aa.pcg_subtype']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgsubtype" value="'.$search_pcgsubtype.'"></td>'; if (!empty($arrayfields['aa.pcg_subtype']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgsubtype" value="'.$search_pcgsubtype.'"></td>';
@ -329,6 +335,7 @@ if ($resql)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (!empty($arrayfields['aa.account_number']['checked'])) print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['aa.account_number']['checked'])) print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['aa.label']['checked'])) print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"], "aa.label", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['aa.label']['checked'])) print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"], "aa.label", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['aa.labelshort']['checked'])) print_liste_field_titre($arrayfields['aa.labelshort']['label'], $_SERVER["PHP_SELF"], "aa.labelshort", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, '', $sortfield, $sortorder, 'left '); if (!empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, '', $sortfield, $sortorder, 'left ');
if (!empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help']); if (!empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help']);
if (!empty($arrayfields['aa.pcg_subtype']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_subtype']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_subtype', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_subtype']['help']); if (!empty($arrayfields['aa.pcg_subtype']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_subtype']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_subtype', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_subtype']['help']);
@ -368,6 +375,15 @@ if ($resql)
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Account label to show (label short)
if (! empty($arrayfields['aa.labelshort']['checked']))
{
print "<td>";
print $obj->labelshort;
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Account parent // Account parent
if (!empty($arrayfields['aa.account_parent']['checked'])) if (!empty($arrayfields['aa.account_parent']['checked']))
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -97,6 +97,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
$object->account_parent = $account_parent; $object->account_parent = $account_parent;
$object->account_category = GETPOST('account_category', 'alpha'); $object->account_category = GETPOST('account_category', 'alpha');
$object->label = GETPOST('label', 'alpha'); $object->label = GETPOST('label', 'alpha');
$object->labelshort = GETPOST('labelshort', 'alpha');
$object->active = 1; $object->active = 1;
$res = $object->create($user); $res = $object->create($user);
@ -162,6 +163,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
$object->account_parent = $account_parent; $object->account_parent = $account_parent;
$object->account_category = GETPOST('account_category', 'alpha'); $object->account_category = GETPOST('account_category', 'alpha');
$object->label = GETPOST('label', 'alpha'); $object->label = GETPOST('label', 'alpha');
$object->labelshort = GETPOST('labelshort', 'alpha');
$result = $object->update($user); $result = $object->update($user);
@ -236,6 +238,10 @@ if ($action == 'create') {
print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td>'; print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td>';
print '<td><input name="label" size="70" value="'.$object->label.'"></td></tr>'; print '<td><input name="label" size="70" value="'.$object->label.'"></td></tr>';
// Label short
print '<tr><td>' . $langs->trans("LabelToShow") . '</td>';
print '<td><input name="labelshort" size="70" value="' . $object->labelshort . '"></td></tr>';
// Account parent // Account parent
print '<tr><td>'.$langs->trans("Accountparent").'</td>'; print '<tr><td>'.$langs->trans("Accountparent").'</td>';
print '<td>'; print '<td>';
@ -254,7 +260,7 @@ if ($action == 'create') {
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(isset($_POST['pcg_type']) ?GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">'; print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(isset($_POST['pcg_type']) ?GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
print '</td></tr>'; print '</td></tr>';
// Chart of acounts subtype // Chart of accounts subtype
print '<tr><td>'.$langs->trans("Pcgsubtype").'</td>'; print '<tr><td>'.$langs->trans("Pcgsubtype").'</td>';
print '<td>'; print '<td>';
print '<input type="text" name="pcg_subtype" value="'.dol_escape_htmltag(isset($_POST['pcg_subtype']) ?GETPOST('pcg_subtype', 'alpha') : $object->pcg_subtype).'">'; print '<input type="text" name="pcg_subtype" value="'.dol_escape_htmltag(isset($_POST['pcg_subtype']) ?GETPOST('pcg_subtype', 'alpha') : $object->pcg_subtype).'">';
@ -301,6 +307,10 @@ elseif ($id > 0 || $ref) {
print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td>'; print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td>';
print '<td><input name="label" size="70" value="'.$object->label.'"</td></tr>'; print '<td><input name="label" size="70" value="'.$object->label.'"</td></tr>';
// Label short
print '<tr><td>' . $langs->trans("LabelToShow") . '</td>';
print '<td><input name="labelshort" size="70" value="' . $object->labelshort . '"</td></tr>';
// Account parent // Account parent
print '<tr><td>'.$langs->trans("Accountparent").'</td>'; print '<tr><td>'.$langs->trans("Accountparent").'</td>';
print '<td>'; print '<td>';
@ -354,6 +364,10 @@ elseif ($id > 0 || $ref) {
print '<tr><td class="titlefield">'.$langs->trans("Label").'</td>'; print '<tr><td class="titlefield">'.$langs->trans("Label").'</td>';
print '<td colspan="2">'.$object->label.'</td></tr>'; print '<td colspan="2">'.$object->label.'</td></tr>';
// Label to show
print '<tr><td class="titlefield">' . $langs->trans("LabelToShow") . '</td>';
print '<td colspan="2">' . $object->labelshort . '</td></tr>';
// Account parent // Account parent
$accp = new AccountingAccount($db); $accp = new AccountingAccount($db);
if (!empty($object->account_parent)) { if (!empty($object->account_parent)) {

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com> * Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
@ -120,6 +120,11 @@ class AccountingAccount extends CommonObject
*/ */
public $label; public $label;
/**
* @var string Label short of account
*/
public $labelshort;
/** /**
* @var int ID * @var int ID
*/ */
@ -162,7 +167,7 @@ class AccountingAccount extends CommonObject
global $conf; global $conf;
if ($rowid || $account_number) { if ($rowid || $account_number) {
$sql = "SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.pcg_subtype, a.account_number, a.account_parent, a.label, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active"; $sql = "SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.pcg_subtype, a.account_number, a.account_parent, a.label, a.labelshort, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active";
$sql .= ", ca.label as category_label"; $sql .= ", ca.label as category_label";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as a"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as a";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as ca ON a.fk_accounting_category = ca.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as ca ON a.fk_accounting_category = ca.rowid";
@ -196,6 +201,7 @@ class AccountingAccount extends CommonObject
$this->account_number = $obj->account_number; $this->account_number = $obj->account_number;
$this->account_parent = $obj->account_parent; $this->account_parent = $obj->account_parent;
$this->label = $obj->label; $this->label = $obj->label;
$this->labelshort = $obj->labelshort;
$this->account_category = $obj->fk_accounting_category; $this->account_category = $obj->fk_accounting_category;
$this->account_category_label = $obj->category_label; $this->account_category_label = $obj->category_label;
$this->fk_user_author = $obj->fk_user_author; $this->fk_user_author = $obj->fk_user_author;
@ -239,6 +245,8 @@ class AccountingAccount extends CommonObject
$this->account_number = trim($this->account_number); $this->account_number = trim($this->account_number);
if (isset($this->label)) if (isset($this->label))
$this->label = trim($this->label); $this->label = trim($this->label);
if (isset($this->labelshort))
$this->labelshort = trim($this->labelshort);
if (empty($this->pcg_type) || $this->pcg_type == '-1') if (empty($this->pcg_type) || $this->pcg_type == '-1')
{ {
@ -261,6 +269,7 @@ class AccountingAccount extends CommonObject
$sql .= ", account_number"; $sql .= ", account_number";
$sql .= ", account_parent"; $sql .= ", account_parent";
$sql .= ", label"; $sql .= ", label";
$sql .= ", labelshort";
$sql .= ", fk_accounting_category"; $sql .= ", fk_accounting_category";
$sql .= ", fk_user_author"; $sql .= ", fk_user_author";
$sql .= ", active"; $sql .= ", active";
@ -273,6 +282,7 @@ class AccountingAccount extends CommonObject
$sql .= ", " . (empty($this->account_number) ? 'NULL' : "'" . $this->db->escape($this->account_number) . "'"); $sql .= ", " . (empty($this->account_number) ? 'NULL' : "'" . $this->db->escape($this->account_number) . "'");
$sql .= ", " . (empty($this->account_parent) ? 0 : (int) $this->account_parent); $sql .= ", " . (empty($this->account_parent) ? 0 : (int) $this->account_parent);
$sql .= ", " . (empty($this->label) ? "''" : "'" . $this->db->escape($this->label) . "'"); $sql .= ", " . (empty($this->label) ? "''" : "'" . $this->db->escape($this->label) . "'");
$sql .= ", " . (empty($this->labelshort) ? "''" : "'" . $this->db->escape($this->labelshort) . "'");
$sql .= ", " . (empty($this->account_category) ? 0 : (int) $this->account_category); $sql .= ", " . (empty($this->account_category) ? 0 : (int) $this->account_category);
$sql .= ", " . $user->id; $sql .= ", " . $user->id;
$sql .= ", " . (int) $this->active; $sql .= ", " . (int) $this->active;
@ -344,6 +354,7 @@ class AccountingAccount extends CommonObject
$sql .= " , account_number = '" . $this->db->escape($this->account_number) . "'"; $sql .= " , account_number = '" . $this->db->escape($this->account_number) . "'";
$sql .= " , account_parent = " . (int) $this->account_parent; $sql .= " , account_parent = " . (int) $this->account_parent;
$sql .= " , label = " . ($this->label ? "'" . $this->db->escape($this->label) . "'" : "''"); $sql .= " , label = " . ($this->label ? "'" . $this->db->escape($this->label) . "'" : "''");
$sql .= " , labelshort = " . ($this->labelshort ? "'" . $this->db->escape($this->labelshort) . "'" : "''");
$sql .= " , fk_accounting_category = " . (empty($this->account_category) ? 0 : (int) $this->account_category); $sql .= " , fk_accounting_category = " . (empty($this->account_category) ? 0 : (int) $this->account_category);
$sql .= " , fk_user_modif = " . $user->id; $sql .= " , fk_user_modif = " . $user->id;
$sql .= " , active = " . (int) $this->active; $sql .= " , active = " . (int) $this->active;
@ -461,9 +472,10 @@ class AccountingAccount extends CommonObject
* @param string $moretitle Add more text to title tooltip * @param string $moretitle Add more text to title tooltip
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @param int $withcompletelabel 0=Short label (field short label), 1=Complete label (field label)
* @return string String with URL * @return string String with URL
*/ */
public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1) public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1, $withcompletelabel = 0)
{ {
global $langs, $conf, $user; global $langs, $conf, $user;
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -482,11 +494,18 @@ class AccountingAccount extends CommonObject
$picto = 'billr'; $picto = 'billr';
$label=''; $label='';
if (empty($this->labelshort) || $withcompletelabel == 1)
{
$labeltoshow = $this->label;
} else {
$labeltoshow = $this->labelshort;
}
$label = '<u>' . $langs->trans("ShowAccountingAccount") . '</u>'; $label = '<u>' . $langs->trans("ShowAccountingAccount") . '</u>';
if (! empty($this->account_number)) if (! empty($this->account_number))
$label .= '<br><b>'.$langs->trans('AccountAccounting') . ':</b> ' . length_accountg($this->account_number); $label .= '<br><b>'.$langs->trans('AccountAccounting') . ':</b> ' . length_accountg($this->account_number);
if (! empty($this->label)) if (! empty($labeltoshow))
$label .= '<br><b>'.$langs->trans('Label') . ':</b> ' . $this->label; $label .= '<br><b>'.$langs->trans('Label') . ':</b> ' . $labeltoshow;
if ($moretitle) $label.=' - '.$moretitle; if ($moretitle) $label.=' - '.$moretitle;
$linkclose=''; $linkclose='';
@ -513,7 +532,7 @@ class AccountingAccount extends CommonObject
} }
$label_link = length_accountg($this->account_number); $label_link = length_accountg($this->account_number);
if ($withlabel) $label_link .= ' - ' . $this->label; if ($withlabel) $label_link .= ' - ' . $labeltoshow;
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend); if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend);
if ($withpicto && $withpicto != 2) $result .= ' '; if ($withpicto && $withpicto != 2) $result .= ' ';

View File

@ -181,6 +181,10 @@ class Contact extends CommonObject
public $phone_mobile; public $phone_mobile;
public $fax; public $fax;
/**
* Private or public
* @var int
*/
public $priv; public $priv;
public $birthday; public $birthday;

View File

@ -3,7 +3,7 @@
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com> * Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2016-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* *
* 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
@ -292,7 +292,7 @@ class FormAccounting extends Form
{ {
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT) ? 50 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT; $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT) ? 50 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT;
$sql = "SELECT DISTINCT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version"; $sql = "SELECT DISTINCT aa.account_number, aa.label, aa.labelshort, aa.rowid, aa.fk_pcg_version";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = ".$conf->global->CHARTOFACCOUNTS; $sql .= " AND asy.rowid = ".$conf->global->CHARTOFACCOUNTS;
@ -312,7 +312,16 @@ class FormAccounting extends Form
$selected = 0; $selected = 0;
while ($obj = $this->db->fetch_object($resql)) while ($obj = $this->db->fetch_object($resql))
{ {
$label = length_accountg($obj->account_number).' - '.$obj->label; if (empty($obj->labelshort))
{
$labeltoshow = $obj->label;
}
else
{
$labeltoshow = $obj->labelshort;
}
$label = length_accountg($obj->account_number) . ' - ' . $labeltoshow;
$label = dol_trunc($label, $trunclength); $label = dol_trunc($label, $trunclength);
$select_value_in = $obj->rowid; $select_value_in = $obj->rowid;

View File

@ -105,6 +105,8 @@ class mailing_contacts1 extends MailingTargets
$sql.= " WHERE c.entity IN (".getEntity('socpeople').")"; $sql.= " WHERE c.entity IN (".getEntity('socpeople').")";
$sql.= " AND c.email != ''"; // Note that null != '' is false $sql.= " AND c.email != ''"; // Note that null != '' is false
$sql.= " AND c.no_email = 0"; $sql.= " AND c.no_email = 0";
$sql .= " AND (SELECT count(*) FROM ". MAIN_DB_PREFIX . "mailing_unsubscribe WHERE email = c.email) = 0";
// exclude unsubscribed users
$sql.= " AND c.statut = 1"; $sql.= " AND c.statut = 1";
// The request must return a field called "nb" to be understandable by parent::getNbOfRecipients // The request must return a field called "nb" to be understandable by parent::getNbOfRecipients
@ -384,6 +386,8 @@ class mailing_contacts1 extends MailingTargets
$sql.= " WHERE sp.entity IN (".getEntity('socpeople').")"; $sql.= " WHERE sp.entity IN (".getEntity('socpeople').")";
$sql.= " AND sp.email <> ''"; $sql.= " AND sp.email <> ''";
$sql.= " AND sp.no_email = 0"; $sql.= " AND sp.no_email = 0";
$sql .= " AND (SELECT count(*) FROM ". MAIN_DB_PREFIX . "mailing_unsubscribe WHERE email = sp.email) = 0";
// Exclude unsubscribed email adresses
$sql.= " AND sp.statut = 1"; $sql.= " AND sp.statut = 1";
$sql.= " AND sp.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")"; $sql.= " AND sp.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
// Filter on category // Filter on category

View File

@ -51,6 +51,7 @@ create table llx_object_lang
ALTER TABLE llx_object_lang ADD UNIQUE INDEX uk_object_lang (fk_object, type_object, property, lang); ALTER TABLE llx_object_lang ADD UNIQUE INDEX uk_object_lang (fk_object, type_object, property, lang);
ALTER TABLE llx_accounting_account ADD COLUMN labelshort varchar(255) DEFAULT NULL after label;
ALTER TABLE llx_subscription ADD COLUMN fk_user_creat integer DEFAULT NULL; ALTER TABLE llx_subscription ADD COLUMN fk_user_creat integer DEFAULT NULL;
ALTER TABLE llx_subscription ADD COLUMN fk_user_valid integer DEFAULT NULL; ALTER TABLE llx_subscription ADD COLUMN fk_user_valid integer DEFAULT NULL;

View File

@ -1,7 +1,7 @@
-- ============================================================================ -- ============================================================================
-- Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net> -- Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> -- Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
-- Copyright (C) 2016 Alexandre Spangaro <aspangaro@open-dsi.fr> -- Copyright (C) 2016-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
-- --
-- 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
@ -31,6 +31,7 @@ create table llx_accounting_account
account_number varchar(32) NOT NULL, account_number varchar(32) NOT NULL,
account_parent integer DEFAULT 0, -- Hierarchic parent. account_parent integer DEFAULT 0, -- Hierarchic parent.
label varchar(255) NOT NULL, label varchar(255) NOT NULL,
labelshort varchar(255) DEFAULT NULL,
fk_accounting_category integer DEFAULT 0, -- ID of personalized group for report fk_accounting_category integer DEFAULT 0, -- ID of personalized group for report
fk_user_author integer DEFAULT NULL, fk_user_author integer DEFAULT NULL,
fk_user_modif integer DEFAULT NULL, fk_user_modif integer DEFAULT NULL,