FIX warning if setup of chart of account is not yet done.
This commit is contained in:
parent
a0c7c6bad9
commit
680f6257a0
@ -259,7 +259,7 @@ class FormAccounting extends Form
|
||||
* @param string $usecache Key to use to store result into a cache. Next call with same key will reuse the cache.
|
||||
* @return string String with HTML select
|
||||
*/
|
||||
public function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $morecss = 'maxwidth300 maxwidthonsmartphone', $usecache = '')
|
||||
public function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $morecss = 'minwidth100 maxwidth300 maxwidthonsmartphone', $usecache = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
@ -299,38 +299,45 @@ class FormAccounting extends Form
|
||||
return -1;
|
||||
}
|
||||
|
||||
$selected = $selectid; // selectid can be -1, 0, 123
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
if (empty($obj->labelshort))
|
||||
{
|
||||
$labeltoshow = $obj->label;
|
||||
} else {
|
||||
$labeltoshow = $obj->labelshort;
|
||||
}
|
||||
$num_rows = $this->db->num_rows($resql);
|
||||
|
||||
$label = length_accountg($obj->account_number).' - '.$labeltoshow;
|
||||
$label = dol_trunc($label, $trunclength);
|
||||
if ($num_rows == 0) {
|
||||
$langs->load("errors");
|
||||
$showempty = $langs->trans("ErrorYouMustFirstSetupYourChartOfAccount");
|
||||
} else {
|
||||
$selected = $selectid; // selectid can be -1, 0, 123
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
if (empty($obj->labelshort))
|
||||
{
|
||||
$labeltoshow = $obj->label;
|
||||
} else {
|
||||
$labeltoshow = $obj->labelshort;
|
||||
}
|
||||
|
||||
$select_value_in = $obj->rowid;
|
||||
$select_value_out = $obj->rowid;
|
||||
$label = length_accountg($obj->account_number).' - '.$labeltoshow;
|
||||
$label = dol_trunc($label, $trunclength);
|
||||
|
||||
// Try to guess if we have found default value
|
||||
if ($select_in == 1) {
|
||||
$select_value_in = $obj->account_number;
|
||||
}
|
||||
if ($select_out == 1) {
|
||||
$select_value_out = $obj->account_number;
|
||||
}
|
||||
// Remember guy's we store in database llx_facturedet the rowid of accounting_account and not the account_number
|
||||
// Because same account_number can be share between different accounting_system and do have the same meaning
|
||||
if ($selectid != '' && $selectid == $select_value_in) {
|
||||
//var_dump("Found ".$selectid." ".$select_value_in);
|
||||
$selected = $select_value_out;
|
||||
}
|
||||
$select_value_in = $obj->rowid;
|
||||
$select_value_out = $obj->rowid;
|
||||
|
||||
$options[$select_value_out] = $label;
|
||||
// Try to guess if we have found default value
|
||||
if ($select_in == 1) {
|
||||
$select_value_in = $obj->account_number;
|
||||
}
|
||||
if ($select_out == 1) {
|
||||
$select_value_out = $obj->account_number;
|
||||
}
|
||||
// Remember guy's we store in database llx_facturedet the rowid of accounting_account and not the account_number
|
||||
// Because same account_number can be share between different accounting_system and do have the same meaning
|
||||
if ($selectid != '' && $selectid == $select_value_in) {
|
||||
//var_dump("Found ".$selectid." ".$select_value_in);
|
||||
$selected = $select_value_out;
|
||||
}
|
||||
|
||||
$options[$select_value_out] = $label;
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
if ($usecache)
|
||||
@ -340,7 +347,7 @@ class FormAccounting extends Form
|
||||
}
|
||||
}
|
||||
|
||||
$out .= Form::selectarray($htmlname, $options, $selected, ($showempty > 0 ? 1 : 0), 0, 0, '', 0, 0, 0, '', $morecss, 1);
|
||||
$out .= Form::selectarray($htmlname, $options, $selected, ($showempty ? (is_numeric($showempty) ? 1 : $showempty): 0), 0, 0, '', 0, 0, 0, '', $morecss, 1);
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
@ -256,6 +256,7 @@ ErrorPublicInterfaceNotEnabled=Public interface was not enabled
|
||||
ErrorLanguageRequiredIfPageIsTranslationOfAnother=The language of new page must be defined if it is set as a translation of another page
|
||||
ErrorLanguageMustNotBeSourceLanguageIfPageIsTranslationOfAnother=The language of new page must not be the source language if it is set as a translation of another page
|
||||
ErrorAParameterIsRequiredForThisOperation=A parameter is mandatory for this operation
|
||||
ErrorYouMustFirstSetupYourChartOfAccount=You must first setup your chart of account
|
||||
|
||||
# Warnings
|
||||
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.
|
||||
|
||||
@ -919,8 +919,7 @@ if (!empty($conf->barcode->enabled) && !empty($conf->global->BARCODE_PRODUCT_ADD
|
||||
}
|
||||
|
||||
|
||||
if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
{
|
||||
if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// -----------------------------------------
|
||||
// When used with CANVAS
|
||||
// -----------------------------------------
|
||||
@ -936,8 +935,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
// -----------------------------------------
|
||||
// When used in standard mode
|
||||
// -----------------------------------------
|
||||
if ($action == 'create' && $usercancreate)
|
||||
{
|
||||
if ($action == 'create' && $usercancreate) {
|
||||
//WYSIWYG Editor
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
|
||||
@ -1276,7 +1274,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
} else {
|
||||
$accountancy_code_sell = (GETPOSTISSET('accountancy_code_sell') ? GETPOST('accountancy_code_sell', 'alpha') : $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT);
|
||||
}
|
||||
print $formaccounting->select_account($accountancy_code_sell, 'accountancy_code_sell', 1, null, 1, 1, '');
|
||||
print $formaccounting->select_account($accountancy_code_sell, 'accountancy_code_sell', 1, null, 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_sell_intra
|
||||
@ -1289,7 +1287,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
} else {
|
||||
$accountancy_code_sell_intra = (GETPOSTISSET('accountancy_code_sell_intra') ? GETPOST('accountancy_code_sell_intra', 'alpha') : $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT);
|
||||
}
|
||||
print $formaccounting->select_account($accountancy_code_sell_intra, 'accountancy_code_sell_intra', 1, null, 1, 1, '');
|
||||
print $formaccounting->select_account($accountancy_code_sell_intra, 'accountancy_code_sell_intra', 1, null, 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -1302,7 +1300,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
} else {
|
||||
$accountancy_code_sell_export = (GETPOST('accountancy_code_sell_export') ? GETPOST('accountancy_code_sell_export', 'alpha') : $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT);
|
||||
}
|
||||
print $formaccounting->select_account($accountancy_code_sell_export, 'accountancy_code_sell_export', 1, null, 1, 1, '');
|
||||
print $formaccounting->select_account($accountancy_code_sell_export, 'accountancy_code_sell_export', 1, null, 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_buy
|
||||
@ -1313,7 +1311,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
} else {
|
||||
$accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT);
|
||||
}
|
||||
print $formaccounting->select_account($accountancy_code_buy, 'accountancy_code_buy', 1, null, 1, 1, '');
|
||||
print $formaccounting->select_account($accountancy_code_buy, 'accountancy_code_buy', 1, null, 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_buy_intra
|
||||
@ -1326,7 +1324,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
} else {
|
||||
$accountancy_code_buy_intra = (GETPOSTISSET('accountancy_code_buy_intra') ? GETPOST('accountancy_code_buy_intra', 'alpha') : $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT);
|
||||
}
|
||||
print $formaccounting->select_account($accountancy_code_buy_intra, 'accountancy_code_buy_intra', 1, null, 1, 1, '');
|
||||
print $formaccounting->select_account($accountancy_code_buy_intra, 'accountancy_code_buy_intra', 1, null, 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -1339,7 +1337,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
} else {
|
||||
$accountancy_code_buy_export = (GETPOST('accountancy_code_buy_export') ? GETPOST('accountancy_code_buy_export', 'alpha') : $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT);
|
||||
}
|
||||
print $formaccounting->select_account($accountancy_code_buy_export, 'accountancy_code_buy_export', 1, null, 1, 1, '');
|
||||
print $formaccounting->select_account($accountancy_code_buy_export, 'accountancy_code_buy_export', 1, null, 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 1);
|
||||
print '</td></tr>';
|
||||
} else // For external software
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user