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

This commit is contained in:
Laurent Destailleur 2023-09-11 11:53:38 +02:00
commit 8cfdff96de
11 changed files with 82 additions and 29 deletions

View File

@ -16,7 +16,7 @@ jobs:
exakat:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Exakat

View File

@ -11,7 +11,7 @@ jobs:
phpcs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 50 # important!

View File

@ -45,6 +45,8 @@ if (!$user->hasRight('accounting', 'chartofaccount')) {
$action = GETPOST('action', 'aZ09');
$nbletter = GETPOST('ACCOUNTING_LETTERING_NBLETTERS', 'int');
// Parameters ACCOUNTING_* and others
$list = array(
'ACCOUNTING_LENGTH_GACCOUNT',
@ -56,7 +58,8 @@ $list = array(
$list_binding = array(
'ACCOUNTING_DATE_START_BINDING',
'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER'
'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER',
'ACCOUNTING_LETTERING_NBLETTERS'
);
$error = 0;
@ -474,6 +477,24 @@ if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
print '</tr>';
if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
// Number of letters for lettering (3 by default (AAA), min 2 (AA))
print '<tr class="oddeven">';
print '<td>';
print $form->textwithpicto($langs->trans("ACCOUNTING_LETTERING_NBLETTERS"), $langs->trans("ACCOUNTING_LETTERING_NBLETTERS_DESC")) . '</td>';
print '<td class="right">';
if (empty($letter)) {
if (getDolGlobalInt('ACCOUNTING_LETTERING_NBLETTERS')) {
$nbletter = getDolGlobalInt('ACCOUNTING_LETTERING_NBLETTERS');
} else {
$nbletter = 3;
}
}
print '<input class="flat" name="ACCOUNTING_LETTERING_NBLETTERS" id="ACCOUNTING_LETTERING_NBLETTERS" value="' . $nbletter . '" type="number" step="1" min="2" max="3" >' . "\n";
print '</tr>';
// Auto Lettering when transfer in accountancy is realized
print '<tr class="oddeven">';
print '<td>';
print $form->textwithpicto($langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING"), $langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING_DESC")) . '</td>';

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -97,8 +97,8 @@ class Lettering extends BookKeeping
$object->fetch($socid);
if ($object->code_compta == '411CUSTCODE') {
$object->code_compta = '';
if ($object->code_compta_client == '411CUSTCODE') {
$object->code_compta_client = '';
}
if ($object->code_compta_fournisseur == '401SUPPCODE') {
@ -106,7 +106,7 @@ class Lettering extends BookKeeping
}
/**
* Prise en charge des lettering complexe avec prelevment , virement
* Support for complex lettering with debit, credit transfer
*/
$sql = "SELECT DISTINCT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.subledger_account, ";
$sql .= " bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant ";
@ -114,10 +114,10 @@ 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 ($object->code_compta != "") {
$sql .= " bk.subledger_account = '".$this->db->escape($object->code_compta)."' ";
if ($object->code_compta_client != "") {
$sql .= " bk.subledger_account = '".$this->db->escape($object->code_compta_client)."' ";
}
if ($object->code_compta != "" && $object->code_compta_fournisseur != "") {
if ($object->code_compta_client != "" && $object->code_compta_fournisseur != "") {
$sql .= " OR ";
}
if ($object->code_compta_fournisseur != "") {
@ -149,10 +149,10 @@ 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 ($object->code_compta != "") {
$sql .= " bk.subledger_account = '".$this->db->escape($object->code_compta)."' ";
if ($object->code_compta_client != "") {
$sql .= " bk.subledger_account = '".$this->db->escape($object->code_compta_client)."' ";
}
if ($object->code_compta != "" && $object->code_compta_fournisseur != "") {
if ($object->code_compta_client != "" && $object->code_compta_fournisseur != "") {
$sql .= " OR ";
}
if ($object->code_compta_fournisseur != "") {
@ -178,10 +178,10 @@ 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 ($object->code_compta != "") {
$sql .= " bk.subledger_account = '".$this->db->escape($object->code_compta)."' ";
if ($object->code_compta_client != "") {
$sql .= " bk.subledger_account = '".$this->db->escape($object->code_compta_client)."' ";
}
if ($object->code_compta != "" && $object->code_compta_fournisseur != "") {
if ($object->code_compta_client != "" && $object->code_compta_fournisseur != "") {
$sql .= " OR ";
}
if ($object->code_compta_fournisseur != "") {
@ -210,10 +210,10 @@ 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 ($object->code_compta != "") {
$sql .= " bk.subledger_account = '".$this->db->escape($object->code_compta)."' ";
if ($object->code_compta_client != "") {
$sql .= " bk.subledger_account = '".$this->db->escape($object->code_compta_client)."' ";
}
if ($object->code_compta != "" && $object->code_compta_fournisseur != "") {
if ($object->code_compta_client != "" && $object->code_compta_fournisseur != "") {
$sql .= " OR ";
}
if ($object->code_compta_fournisseur != "") {
@ -238,10 +238,10 @@ 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 ($object->code_compta != "") {
$sql .= " bk.subledger_account = '".$this->db->escape($object->code_compta)."' ";
if ($object->code_compta_client != "") {
$sql .= " bk.subledger_account = '".$this->db->escape($object->code_compta_client)."' ";
}
if ($object->code_compta != "" && $object->code_compta_fournisseur != "") {
if ($object->code_compta_client != "" && $object->code_compta_fournisseur != "") {
$sql .= " OR ";
}
if ($object->code_compta_fournisseur != "") {
@ -288,7 +288,9 @@ class Lettering extends BookKeeping
public function updateLettering($ids = array(), $notrigger = false)
{
$error = 0;
$lettre = 'AAA';
// Generate a string with n char A where n is ACCOUNTING_LETTERING_NBLETTERS (So 'AA', 'AAA', ...)
$lettre = str_pad("", getDolGlobalInt('ACCOUNTING_LETTERING_NBLETTERS', 3), "A");
$sql = "SELECT DISTINCT ab2.lettering_code";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab";
@ -327,7 +329,6 @@ class Lettering extends BookKeeping
}
// Update request
$now = dol_now();
$affected_rows = 0;

View File

@ -143,6 +143,9 @@ if (GETPOST('zipcode') || GETPOST('town')) {
}
echo json_encode($return_arr);
} elseif (GETPOSTISSET('country_codeid')) {
$formcompany = new FormCompany($db);
print $formcompany->select_state(GETPOST('selected', 'int', 1), GETPOST('country_codeid', 'int', 1), GETPOST('htmlname', 'alpha', 1), GETPOST('morecss', 'alpha', 1));
}
$db->close();

View File

@ -368,6 +368,32 @@ class FormCompany extends Form
return $out;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns the drop-down list of departments/provinces/cantons for all countries or for a given country.
* In the case of an all-country list, the display breaks on the country.
* The key of the list is the code (there can be several entries for a given code but in this case, the country field differs).
* Thus the links with the departments are done on a department independently of its name.
*
* @param string $parent_field_id Parent select name to monitor
* @param integer $selected Code state preselected (mus be state id)
* @param integer $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show
* @param string $htmlname Id of department. If '', we want only the string with <option>
* @param string $morecss Add more css
* @return string String with HTML select
* @see select_country()
*/
public function select_state_ajax($parent_field_id = 'country_id', $selected = 0, $country_codeid = 0, $htmlname = 'state_id', $morecss = 'maxwidth200onsmartphone minwidth300')
{
$html = '<script>';
$html.='$("select[name=\"'.$parent_field_id.'\"]").change(function(){
$.ajax( "'.dol_buildpath('/core/ajax/ziptown.php', 2).'", { data:{ selected: $("select[name=\"'.$htmlname.'\"]").val(), country_codeid: $(this).val(), htmlname:"'.$htmlname.'", morecss:"'.$morecss.'" } } )
.done(function(msg) {
$("span#target_'.$htmlname.'").html(msg);
})
});';
return $html.'</script><span id="target_'.$htmlname.'">'.$this->select_state($selected, $country_codeid, $htmlname, $morecss).'</span>';
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**

View File

@ -497,7 +497,7 @@ function dol_shutdown()
$depth = $db->transaction_opened;
$disconnectdone = $db->close();
}
dol_syslog("--- End access to ".(empty($_SERVER["PHP_SELF"]) ? 'unknown' : $_SEVER["PHP_SELF"]).(($disconnectdone && $depth) ? ' (Warn: db disconnection forced, transaction depth was '.$depth.')' : ''), (($disconnectdone && $depth) ? LOG_WARNING : LOG_INFO));
dol_syslog("--- End access to ".(empty($_SERVER["PHP_SELF"]) ? 'unknown' : $_SERVER["PHP_SELF"]).(($disconnectdone && $depth) ? ' (Warn: db disconnection forced, transaction depth was '.$depth.')' : ''), (($disconnectdone && $depth) ? LOG_WARNING : LOG_INFO));
}
/**

View File

@ -353,6 +353,8 @@ ACCOUNTING_ENABLE_LETTERING_DESC=When this options is enabled, you can define, o
EnablingThisFeatureIsNotNecessary=Enabling this feature is no more necessary for a rigourous accounting management.
ACCOUNTING_ENABLE_AUTOLETTERING=Enable the automatic lettering when transferring to accounting
ACCOUNTING_ENABLE_AUTOLETTERING_DESC=The code for the lettering is automatically generated and incremented and not choosed by the end user
ACCOUNTING_LETTERING_NBLETTERS=Number of letters when generating lettering code (default 3)
ACCOUNTING_LETTERING_NBLETTERS_DESC=Some accounting software only accepts a two-letter code. This parameter allows you to set this aspect. The default number of letters is three.
OptionsAdvanced=Advanced options
ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE=Activate the management of VAT reverse charge on supplier purchases
ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE_DESC=When this option is enabled, you can define that a supplier or a given vendor invoice must be transfered into accountancy differently: A additionnal debit and a credit line will generated into the accounting on 2 given accounts from the chart of account defined into the "%s" setup page.

View File

@ -89,6 +89,6 @@ ThisIsInformationOnDocumentToSignSociete_rib=This is information on SEPA Mandate
SignatureProposalRef=Signature of quote/commercial proposal %s
SignatureContractRef=Signature of contract %s
SignatureFichinterRef=Signature of intervention %s
SignatureSociete_ribRef=Signature of SEPA mandat %s
SignatureSociete_ribRef=Signature of SEPA Mandate %s
SignSociete_rib=Signature of SEPA Mandate %s
FeatureOnlineSignDisabled=Feature for online signing disabled or document generated before the feature was enabled

View File

@ -192,7 +192,7 @@ ErrorGlobalVariableUpdater4=SOAP client failed with error '%s'
ErrorGlobalVariableUpdater5=No global variable selected
ErrorFieldMustBeANumeric=Field <b>%s</b> must be a numeric value
ErrorMandatoryParametersNotProvided=Mandatory parameter(s) not provided
ErrorOppStatusRequiredIfUsage=You set you want to use this project to follow an opportunity, so you must also fill the initial Status of opportunity.
ErrorOppStatusRequiredIfUsage=You choose to follow an opportunity in this project, so you must also fill out the Lead status.
ErrorOppStatusRequiredIfAmount=You set an estimated amount for this lead. So you must also enter it's status.
ErrorFailedToLoadModuleDescriptorForXXX=Failed to load module descriptor class for %s
ErrorBadDefinitionOfMenuArrayInModuleDescriptor=Bad Definition Of Menu Array In Module Descriptor (bad value for key fk_menu)

View File

@ -1142,7 +1142,7 @@ if ($action == 'create' || $action == 'adduserldap') {
// Country
print '<tr><td>'.$form->editfieldkey('Country', 'selectcountry_id', '', $object, 0).'</td><td class="maxwidthonsmartphone">';
print img_picto('', 'country', 'class="pictofixedwidth"');
print $form->select_country((GETPOST('country_id') != '' ?GETPOST('country_id') : $object->country_id));
print $form->select_country((GETPOST('country_id') != '' ?GETPOST('country_id') : $object->country_id), 'country_id');
if ($user->admin) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
@ -1152,7 +1152,7 @@ if ($action == 'create' || $action == 'adduserldap') {
if (empty($conf->global->USER_DISABLE_STATE)) {
print '<tr><td>'.$form->editfieldkey('State', 'state_id', '', $object, 0).'</td><td class="maxwidthonsmartphone">';
print img_picto('', 'state', 'class="pictofixedwidth"');
print $formcompany->select_state($object->state_id, $object->country_code, 'state_id');
print $formcompany->select_state_ajax('country_id', $object->state_id, $object->country_id, 'state_id');
print '</td></tr>';
}