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

This commit is contained in:
Laurent Destailleur 2019-06-20 03:43:27 +02:00
commit ee8e7d66f8
23 changed files with 152 additions and 88 deletions

View File

@ -1,7 +1,7 @@
#----------------------------------------------------------------------------
# \file dolibarr.pl
# \brief Dolibarr script install for Virtualmin Pro
# \author (c)2009-2018 Regis Houssin <regis.houssin@inodbox.com>
# \author (c)2009-2019 Regis Houssin <regis.houssin@inodbox.com>
#----------------------------------------------------------------------------
@ -30,7 +30,7 @@ return "Regis Houssin";
# script_dolibarr_versions()
sub script_dolibarr_versions
{
return ( "9.0.0", "8.0.3", "7.0.4", "6.0.8", "5.0.7" );
return ( "10.0.0", "9.0.3", "8.0.5", "7.0.5", "6.0.8" );
}
sub script_dolibarr_release
@ -390,6 +390,7 @@ sub script_dolibarr_check_latest
{
local ($ver) = @_;
local @vers = &osdn_package_versions("dolibarr",
$ver >= 10.0 ? "dolibarr\\-(10\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 9.0 ? "dolibarr\\-(9\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 8.0 ? "dolibarr\\-(8\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 7.0 ? "dolibarr\\-(7\\.0\\.[0-9\\.]+)\\.tgz" :

View File

@ -348,7 +348,7 @@ while ($i < min($num, $limit))
$colspan = 9;
print "<tr>";
print '<td colspan="'.$colspan.'" style="font-weight:bold; border-bottom: 1pt solid black;">';
if (! empty($line->numero_compte) && $line->numero_compte != '-1') print length_accountg($line->numero_compte) . ' : ' . $object->get_compte_desc($line->numero_compte);
if ($line->numero_compte != "" && $line->numero_compte != '-1') print length_accountg($line->numero_compte) . ' : ' . $object->get_compte_desc($line->numero_compte);
else print '<span class="error">'.$langs->trans("Unknown").'</span>';
print '</td>';
print '</tr>';

View File

@ -67,11 +67,11 @@ class Lettering extends BookKeeping
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu ON(bk.fk_doc = bu.fk_bank AND bu.type IN ('payment', 'payment_supplier') ) ";
$sql .= " WHERE ( ";
if (! empty($object->code_compta))
if ($object->code_compta != "")
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur))
if ($object->code_compta != "" && $object->code_compta_fournisseur != "")
$sql .= " OR ";
if (! empty($object->code_compta_fournisseur))
if ($object->code_compta_fournisseur != "")
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
$sql .= " ) AND (bk.date_lettering ='' OR bk.date_lettering IS NULL) ";
@ -99,13 +99,13 @@ class Lettering extends BookKeeping
$sql .= " AND facf.entity = ".$conf->entity;
$sql .= " AND code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=4 AND entity=".$conf->entity.") ";
$sql .= " AND ( ";
if (! empty($object->code_compta)) {
if ($object->code_compta != "") {
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
}
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) {
if ($object->code_compta != "" && $object->code_compta_fournisseur != "") {
$sql .= " OR ";
}
if (! empty($object->code_compta_fournisseur)) {
if ($object->code_compta_fournisseur != "") {
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
}
$sql .= " ) ";
@ -127,13 +127,13 @@ class Lettering extends BookKeeping
$sql .= " WHERE bk.code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=3 AND entity=".$conf->entity.") ";
$sql .= " AND facf.entity = ".$conf->entity;
$sql .= " AND ( ";
if (! empty($object->code_compta)) {
if ($object->code_compta != "") {
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
}
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) {
if ($object->code_compta != "" && $object->code_compta_fournisseur != "") {
$sql .= " OR ";
}
if (! empty($object->code_compta_fournisseur)) {
if ($object->code_compta_fournisseur != "") {
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
}
$sql .= ") ";
@ -159,13 +159,13 @@ class Lettering extends BookKeeping
$sql .= " AND bk.code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=4 AND entity=".$conf->entity.") ";
$sql .= " AND fac.entity IN (".getEntity('invoice', 0).")";// We don't share object for accountancy
$sql .= " AND ( ";
if (! empty($object->code_compta)) {
if ($object->code_compta != "") {
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
}
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) {
if ($object->code_compta != "" && $object->code_compta_fournisseur != "") {
$sql .= " OR ";
}
if (! empty($object->code_compta_fournisseur)) {
if ($object->code_compta_fournisseur != "") {
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
}
$sql .= " ) ";
@ -187,13 +187,13 @@ class Lettering extends BookKeeping
$sql .= " WHERE code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=2 AND entity=".$conf->entity.") ";
$sql .= " AND fac.entity IN (".getEntity('invoice', 0).")";// We don't share object for accountancy
$sql .= " AND ( ";
if (! empty($object->code_compta)) {
if ($object->code_compta != "") {
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
}
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) {
if ($object->code_compta != "" && $object->code_compta_fournisseur != "") {
$sql .= " OR ";
}
if (! empty($object->code_compta_fournisseur)) {
if ($object->code_compta_fournisseur != "") {
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
}
$sql .= " ) ";

View File

@ -171,8 +171,8 @@ if ($result) {
//print $sql;
// Variables
$account_supplier = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'); // NotDefined is a reserved word
$account_customer = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined'); // NotDefined is a reserved word
$account_supplier = (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'); // NotDefined is a reserved word
$account_customer = ($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER != "") ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined'); // NotDefined is a reserved word
$account_employee = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined'); // NotDefined is a reserved word
$account_pay_vat = (! empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : 'NotDefined'); // NotDefined is a reserved word
$account_pay_donation = (! empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word
@ -218,7 +218,7 @@ if ($result) {
// Set accountancy code for thirdparty
$compta_soc = 'NotDefined';
if ($lineisapurchase > 0)
$compta_soc = (! empty($obj->code_compta_fournisseur) ? $obj->code_compta_fournisseur : $account_supplier);
$compta_soc = (($obj->code_compta_fournisseur != "") ? $obj->code_compta_fournisseur : $account_supplier);
if ($lineisasale > 0)
$compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $account_customer);
@ -938,8 +938,8 @@ if (empty($action) || $action == 'view') {
// Button to write into Ledger
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|| empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1'
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|| ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1'
|| empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
print '<br>'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
@ -950,8 +950,8 @@ if (empty($action) || $action == 'view') {
if (! empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|| empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|| ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
}
else {

View File

@ -444,10 +444,10 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
foreach ($taber as $key => $val) {
$date = dol_print_date($val["date"], 'day');
$userstatic->id = $tabuser[$key]['id'];
$userstatic->name = $tabuser[$key]['name'];
// Fees
foreach ($tabht[$key] as $k => $mt) {
$accountingaccount = new AccountingAccount($db);
@ -474,7 +474,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print "\n";
}
}
// Third party
foreach ($tabttc[$key] as $k => $mt) {
print '"' . $date . '"' . $sep;
@ -585,7 +585,7 @@ if (empty($action) || $action == 'view') {
// Account
print "<td>";
$accountoshow = length_accountg($k);
if (empty($accountoshow) || $accountoshow == 'NotDefined')
if (($accountoshow == "") || $accountoshow == 'NotDefined')
{
print '<span class="error">'.$langs->trans("FeeAccountNotDefined").'</span>';
}
@ -615,7 +615,7 @@ if (empty($action) || $action == 'view') {
// Account
print "<td>";
$accountoshow = length_accounta($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT);
if (empty($accountoshow) || $accountoshow == 'NotDefined')
if (($accountoshow == "") || $accountoshow == 'NotDefined')
{
print '<span class="error">'.$langs->trans("MainAccountForUsersNotDefined").'</span>';
}
@ -624,7 +624,7 @@ if (empty($action) || $action == 'view') {
// Subledger account
print "<td>";
$accountoshow = length_accounta($k);
if (empty($accountoshow) || $accountoshow == 'NotDefined')
if (($accountoshow == "") || $accountoshow == 'NotDefined')
{
print '<span class="error">'.$langs->trans("UserAccountNotDefined").'</span>';
}
@ -652,7 +652,7 @@ if (empty($action) || $action == 'view') {
// Account
print "<td>";
$accountoshow = length_accountg($k);
if (empty($accountoshow) || $accountoshow == 'NotDefined')
if (($accountoshow == "") || $accountoshow == 'NotDefined')
{
print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>';
}

View File

@ -749,7 +749,7 @@ if (empty($action) || $action == 'view') {
}
print '<div class="tabsAction tabsActionNoBottom">';
if (! empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
if (empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
if (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
}
else {

View File

@ -146,7 +146,7 @@ if ($result) {
$num = $db->num_rows($result);
// Variables
$cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined';
$cptcli = (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER != "")) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined';
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : 'NotDefined';
$i = 0;
@ -679,14 +679,14 @@ if (empty($action) || $action == 'view') {
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
// Button to write into Ledger
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
print '<br>';
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
}
print '<div class="tabsAction tabsActionNoBottom">';
if (! empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
}
else {
@ -813,7 +813,7 @@ if (empty($action) || $action == 'view') {
// Account
print "<td>";
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER);
if (empty($accountoshow) || $accountoshow == 'NotDefined')
if (($accountoshow == "") || $accountoshow == 'NotDefined')
{
print '<span class="error">'.$langs->trans("MainAccountForCustomersNotDefined").'</span>';
}
@ -822,7 +822,7 @@ if (empty($action) || $action == 'view') {
// Subledger account
print "<td>";
$accountoshow = length_accounta($k);
if (empty($accountoshow) || $accountoshow == 'NotDefined')
if (($accountoshow == "") || $accountoshow == 'NotDefined')
{
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
}
@ -849,7 +849,7 @@ if (empty($action) || $action == 'view') {
// Account
print "<td>";
$accountoshow = length_accountg($k);
if (empty($accountoshow) || $accountoshow == 'NotDefined')
if (($accountoshow == "") || $accountoshow == 'NotDefined')
{
print '<span class="error">'.$langs->trans("ProductNotDefined").'</span>';
}
@ -884,7 +884,7 @@ if (empty($action) || $action == 'view') {
// Account
print "<td>";
$accountoshow = length_accountg($k);
if (empty($accountoshow) || $accountoshow == 'NotDefined')
if (($accountoshow == "") || $accountoshow == 'NotDefined')
{
print '<span class="error">'.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Sale").')'.'</span>';
}

View File

@ -86,7 +86,7 @@ class Categories extends DolibarrApi
throw new RestException(404, 'category not found');
}
if ( ! DolibarrApi::_checkAccessToResource('category', $this->category->id)) {
if ( ! DolibarrApi::_checkAccessToResource('categorie', $this->category->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}

View File

@ -1186,33 +1186,34 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
}
}
$ids1='';$ids2='';
if (count($cases1[$h]) && array_keys($cases1[$h])) $ids1=join(',', array_keys($cases1[$h]));
if (count($cases2[$h]) && array_keys($cases2[$h])) $ids2=join(',', array_keys($cases2[$h]));
$ids1='';
$ids2='';
if (is_array($cases1[$h]) && count($cases1[$h]) && array_keys($cases1[$h])) $ids1=join(',', array_keys($cases1[$h]));
if (is_array($cases2[$h]) && count($cases2[$h]) && array_keys($cases2[$h])) $ids2=join(',', array_keys($cases2[$h]));
if ($h == $begin_h) echo '<td class="'.$style.'_peruserleft cal_peruser'.($var?' cal_impair '.$style.'_impair':'').'">';
else echo '<td class="'.$style.' cal_peruser'.($var?' cal_impair '.$style.'_impair':'').'">';
if (count($cases1[$h]) == 1) // only 1 event
if (is_array($cases1[$h]) && count($cases1[$h]) == 1) // only 1 event
{
$output = array_slice($cases1[$h], 0, 1);
$title1=$langs->trans("Ref").' '.$ids1.($title1?' - '.$title1:'');
if ($output[0]['string']) $title1.=($title1?' - ':'').$output[0]['string'];
if ($output[0]['color']) $color1 = $output[0]['color'];
}
elseif (count($cases1[$h]) > 1)
elseif (is_array($cases1[$h]) && count($cases1[$h]) > 1)
{
$title1=$langs->trans("Ref").' '.$ids1.($title1?' - '.$title1:'');
$color1='222222';
}
if (count($cases2[$h]) == 1) // only 1 event
if (is_array($cases2[$h]) && count($cases2[$h]) == 1) // only 1 event
{
$output = array_slice($cases2[$h], 0, 1);
$title2=$langs->trans("Ref").' '.$ids2.($title2?' - '.$title2:'');
if ($output[0]['string']) $title2.=($title2?' - ':'').$output[0]['string'];
if ($output[0]['color']) $color2 = $output[0]['color'];
}
elseif (count($cases2[$h]) > 1)
elseif (is_array($cases2[$h]) && count($cases2[$h]) > 1)
{
$title2=$langs->trans("Ref").' '.$ids2.($title2?' - '.$title2:'');
$color2='222222';

View File

@ -123,7 +123,7 @@ if ($result)
{
$num = $db->num_rows($result);
// les variables
$cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)?$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER:$langs->trans("CodeNotDef"));
$cptfour = (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "")?$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER:$langs->trans("CodeNotDef"));
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)?$conf->global->ACCOUNTING_VAT_BUY_ACCOUNT:$langs->trans("CodeNotDef"));
$tabfac = array();
@ -139,7 +139,7 @@ if ($result)
{
$obj = $db->fetch_object($result);
// contrôles
$compta_soc = (! empty($obj->code_compta_fournisseur)?$obj->code_compta_fournisseur:$cptfour);
$compta_soc = (($obj->code_compta_fournisseur != "")?$obj->code_compta_fournisseur:$cptfour);
$compta_prod = $obj->accountancy_code_buy;
if (empty($compta_prod))
{

View File

@ -146,7 +146,7 @@ if ($result)
{
$obj = $db->fetch_object($result);
// les variables
$cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)?$conf->global->ACCOUNTING_ACCOUNT_CUSTOMER:$langs->trans("CodeNotDef"));
$cptcli = (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER != "")?$conf->global->ACCOUNTING_ACCOUNT_CUSTOMER:$langs->trans("CodeNotDef"));
$compta_soc = (! empty($obj->code_compta)?$obj->code_compta:$cptcli);
$compta_prod = $obj->accountancy_code_sell;
if (empty($compta_prod))

View File

@ -21,7 +21,7 @@
/**
* \file htdocs/core/class/html.formaccounting.class.php
* \ingroup Advanced accountancy
* \ingroup Accountancy (Double entries)
* \brief File of class with all html predefined components
*/
require_once DOL_DOCUMENT_ROOT .'/core/class/html.form.class.php';
@ -392,7 +392,7 @@ class FormAccounting extends Form
$resql = $this->db->query($sql);
if ($resql) {
while ($obj = $this->db->fetch_object($resql)) {
if (!empty($obj->code_compta_fournisseur)) {
if ($obj->code_compta_fournisseur != "") {
$aux_account[$obj->code_compta_fournisseur] = $obj->code_compta_fournisseur.' ('.$obj->nom.')';
}
}

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2019 Eric Seigne <eric.seigne@cap-rel.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
@ -19,10 +20,26 @@
/**
* \file htdocs/core/lib/accounting.lib.php
* \ingroup Advanced accountancy
* \ingroup Accountancy (Double entries)
* \brief Library of accountancy functions
*/
/**
* Check if a value is empty with some options
*
* @param allow_false : setting this to true will make the function consider a boolean value of false as NOT empty. This parameter is false by default.
* @param allow_ws : setting this to true will make the function consider a string with nothing but white space as NOT empty. This parameter is false by default.
* @return array Bool
* @author Michael - https://www.php.net/manual/fr/function.empty.php#90767
*/
function is_empty($var, $allow_false = false, $allow_ws = false) {
if (!isset($var) || is_null($var) || ($allow_ws == false && trim($var) == "" && !is_bool($var)) || ($allow_false === false && is_bool($var) && $var === false) || (is_array($var) && empty($var))) {
return true;
} else {
return false;
}
}
/**
* Prepare array with list of tabs
*
@ -75,12 +92,12 @@ function length_accountg($account)
{
global $conf;
if ($account < 0 || empty($account)) return '';
if ($account < 0 || is_empty($account)) return '';
if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $account;
if (! is_empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $account;
$g = $conf->global->ACCOUNTING_LENGTH_GACCOUNT;
if (! empty($g)) {
if (! is_empty($g)) {
// Clean parameters
$i = strlen($account);
@ -110,12 +127,12 @@ function length_accounta($accounta)
{
global $conf;
if ($accounta < 0 || empty($accounta)) return '';
if ($accounta < 0 || is_empty($accounta)) return '';
if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $accounta;
if (! is_empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $accounta;
$a = $conf->global->ACCOUNTING_LENGTH_AACCOUNT;
if (! empty($a)) {
if (! is_empty($a)) {
// Clean parameters
$i = strlen($accounta);
@ -158,7 +175,7 @@ function journalHead($nom, $variante, $period, $periodlink, $description, $build
print "\n\n<!-- debut cartouche journal -->\n";
if(! empty($varlink)) $varlink = '?'.$varlink;
if(! is_empty($varlink)) $varlink = '?'.$varlink;
$head=array();
$h=0;

View File

@ -175,18 +175,29 @@ function pdf_getInstance($format = '', $metric = 'mm', $pagetype = 'P')
/**
* Return if pdf file is protected/encrypted
*
* @param TCPDF $pdf PDF initialized object
* @param string $pathoffile Path of file
* @return boolean True or false
*/
function pdf_getEncryption(&$pdf, $pathoffile)
function pdf_getEncryption($pathoffile)
{
require_once TCPDF_PATH.'tcpdf_parser.php';
$isencrypted = false;
$pdfparser = $pdf->_getPdfParser($pathoffile);
$data = $pdfparser->getParsedData();
if (isset($data[0]['trailer'][1]['/Encrypt'])) {
$isencrypted = true;
$content = file_get_contents($pathoffile);
//ob_start();
@($parser = new \TCPDF_PARSER(ltrim($content)));
list($xref, $data) = $parser->getParsedData();
unset($parser);
//ob_end_clean();
if (isset($xref['trailer']['encrypt'])) {
$isencrypted = true; // Secured pdf file are currently not supported
}
if (empty($data)) {
$isencrypted = true; // Object list not found. Possible secured file
}
return $isencrypted;

View File

@ -144,7 +144,7 @@ class modSalaries extends DolibarrModules
$r++;
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='Salaries and payments';
$this->export_label[$r]='SalariesAndPayments';
$this->export_permission[$r]=array(array("salaries","export"));
$this->export_fields_array[$r]=array('u.firstname'=>"Firstname",'u.lastname'=>"Lastname",'u.login'=>"Login",'u.salary'=>'CurrentSalary','p.datep'=>'DatePayment','p.datesp'=>'DateStartPeriod','p.dateep'=>'DateEndPeriod','p.amount'=>'AmountPayment','p.num_payment'=>'Numero','p.label'=>'Label','p.note'=>'Note');
$this->export_TypeFields_array[$r]=array('u.firstname'=>"Text",'u.lastname'=>"Text",'u.login'=>'Text','u.salary'=>"Numeric",'p.datep'=>'Date','p.datesp'=>'Date','p.dateep'=>'Date','p.amount'=>'Numeric','p.num_payment'=>'Numeric','p.label'=>'Text');

View File

@ -96,8 +96,8 @@ class mod_codecompta_panicum extends ModeleAccountancyCode
$this->code='';
if (is_object($societe)) {
if ($type == 'supplier') $this->code = (! empty($societe->code_compta_fournisseur)?$societe->code_compta_fournisseur:'');
else $this->code = (! empty($societe->code_compta)?$societe->code_compta:'');
if ($type == 'supplier') $this->code = (($societe->code_compta_fournisseur != "")?$societe->code_compta_fournisseur:'');
else $this->code = (($societe->code_compta != "")?$societe->code_compta:'');
}
return 0; // return ok

View File

@ -134,6 +134,7 @@ if (! empty($conf->holiday->enabled))
{
$user_id = $user->id;
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><th colspan="3">'.$langs->trans("Holidays").'</th></tr>';
print "<tr ".$bc[0].">";
@ -152,7 +153,7 @@ if (! empty($conf->holiday->enabled))
print '</td>';
print '</tr>';
print '</table><br>';
print '</table></div><br>';
}
elseif (! is_numeric($conf->global->HOLIDAY_HIDE_BALANCE))
{

View File

@ -27,10 +27,9 @@ CREATE TABLE llx_bom_bom(
qty double(24,8),
efficiency double(8,4) DEFAULT 1,
date_creation datetime NOT NULL,
date_valid datetime NOT NULL,
date_valid datetime,
tms timestamp,
date_valid datetime,
fk_user_creat integer NOT NULL,
fk_user_creat integer NOT NULL,
fk_user_modif integer,
fk_user_valid integer,
import_key varchar(14),

View File

@ -804,6 +804,7 @@ Permission401=Read discounts
Permission402=Create/modify discounts
Permission403=Validate discounts
Permission404=Delete discounts
Permission430=Use Debug Bar
Permission511=Read payments of salaries
Permission512=Create/modify payments of salaries
Permission514=Delete payments of salaries
@ -818,6 +819,9 @@ Permission532=Create/modify services
Permission534=Delete services
Permission536=See/manage hidden services
Permission538=Export services
Permission650=Read bom of Bom
Permission651=Create/Update bom of Bom
Permission652=Delete bom of Bom
Permission701=Read donations
Permission702=Create/modify donations
Permission703=Delete donations
@ -837,6 +841,12 @@ Permission1101=Read delivery orders
Permission1102=Create/modify delivery orders
Permission1104=Validate delivery orders
Permission1109=Delete delivery orders
Permission1121=Read supplier proposals
Permission1122=Create/modify supplier proposals
Permission1123=Validate supplier proposals
Permission1124=Send supplier proposals
Permission1125=Delete supplier proposals
Permission1126=Close supplier price requests
Permission1181=Read suppliers
Permission1182=Read purchase orders
Permission1183=Create/modify purchase orders
@ -859,16 +869,6 @@ Permission1251=Run mass imports of external data into database (data load)
Permission1321=Export customer invoices, attributes and payments
Permission1322=Reopen a paid bill
Permission1421=Export sales orders and attributes
Permission20001=Read leave requests (your leave and those of your subordinates)
Permission20002=Create/modify your leave requests (your leave and those of your subordinates)
Permission20003=Delete leave requests
Permission20004=Read all leave requests (even of user not subordinates)
Permission20005=Create/modify leave requests for everybody (even of user not subordinates)
Permission20006=Admin leave requests (setup and update balance)
Permission23001=Read Scheduled job
Permission23002=Create/update Scheduled job
Permission23003=Delete Scheduled job
Permission23004=Execute Scheduled job
Permission2401=Read actions (events or tasks) linked to his account
Permission2402=Create/modify actions (events or tasks) linked to his account
Permission2403=Delete actions (events or tasks) linked to his account
@ -882,9 +882,38 @@ Permission2503=Submit or delete documents
Permission2515=Setup documents directories
Permission2801=Use FTP client in read mode (browse and download only)
Permission2802=Use FTP client in write mode (delete or upload files)
Permission3200=Read archived events and fingerprints
Permission4001=See employees
Permission4002=Create employees
Permission4003=Delete employees
Permission4004=Export employees
Permission10001=Read website content
Permission10002=Create/modify website content (html and javascript content)
Permission10003=Create/modify website content (dynamic php code). Dangerous, must be reserved to restricted developers.
Permission10005=Delete website content
Permission20001=Read leave requests (your leave and those of your subordinates)
Permission20002=Create/modify your leave requests (your leave and those of your subordinates)
Permission20003=Delete leave requests
Permission20004=Read all leave requests (even of user not subordinates)
Permission20005=Create/modify leave requests for everybody (even of user not subordinates)
Permission20006=Admin leave requests (setup and update balance)
Permission23001=Read Scheduled job
Permission23002=Create/update Scheduled job
Permission23003=Delete Scheduled job
Permission23004=Execute Scheduled job
Permission50101=Use Point of Sale
Permission50201=Read transactions
Permission50202=Import transactions
Permission50401=Bind products and invoices with accounting accounts
Permission50411=Read operations in ledger
Permission50412=Write/Edit operations in ledger
Permission50420=Report and export reports (turnover, balance, journals, ledger)
Permission50430=Define and close a fiscal year
Permission50440=Manage chart of accounts, setup of accountancy
Permission51001=Read assets
Permission51002=Create/Update assets
Permission51003=Delete assets
Permission51005=Setup types of asset
Permission54001=Print
Permission55001=Read polls
Permission55002=Create/modify polls

View File

@ -17,3 +17,5 @@ TJMDescription=This value is currently for information only and is not used for
LastSalaries=Latest %s salary payments
AllSalaries=All salary payments
SalariesStatistics=Salary statistics
# Export
SalariesAndPayments=Salaries and payments

View File

@ -100,4 +100,6 @@ DynamicPHPCodeContainsAForbiddenInstruction=You add dynamic PHP code that contai
NotAllowedToAddDynamicContent=You don't have permission to add or edit PHP dynamic content in websites. Ask permission or just keep code into php tags unmodified.
ReplaceWebsiteContent=Replace website content
DeleteAlsoJs=Delete also all javascript files specific to this website?
DeleteAlsoMedias=Delete also all medias files specific to this website?
DeleteAlsoMedias=Delete also all medias files specific to this website?
# Export
MyWebsitePages=My website pages

View File

@ -179,6 +179,7 @@ $sql.= $db->plimit($max, 0);
$resql=$db->query($sql);
if ($resql)
{
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<th colspan="4">'.$langs->trans("LatestModifiedProjects", $max).'</th></tr>';
@ -242,7 +243,7 @@ if ($resql)
$i++;
}
}
print "</table><br>";
print "</table></div><br>";
}
else dol_print_error($db);

View File

@ -928,7 +928,7 @@ class Societe extends CommonObject
if (! empty($allowmodcodefournisseur) && ! empty($this->fournisseur))
{
// Attention get_codecompta peut modifier le code suivant le module utilise
if (empty($this->code_compta_fournisseur))
if ($this->code_compta_fournisseur == "")
{
$ret=$this->get_codecompta('supplier');
if ($ret < 0) return -1;
@ -1085,7 +1085,7 @@ class Societe extends CommonObject
if ($supplier)
{
$sql .= ", code_fournisseur = ".(! empty($this->code_fournisseur)?"'".$this->db->escape($this->code_fournisseur)."'":"null");
$sql .= ", code_compta_fournisseur = ".(! empty($this->code_compta_fournisseur)?"'".$this->db->escape($this->code_compta_fournisseur)."'":"null");
$sql .= ", code_compta_fournisseur = ".(($this->code_compta_fournisseur != "")?"'".$this->db->escape($this->code_compta_fournisseur)."'":"null");
}
$sql .= ", fk_user_modif = ".($user->id > 0 ? $user->id:"null");
$sql .= ", fk_multicurrency = ".(int) $this->fk_multicurrency;