Skip to content

Commit

Permalink
Merge branch 'develop' into jyhere/product-statspage-add-shipments-re…
Browse files Browse the repository at this point in the history
…ceptions
  • Loading branch information
eldy authored Apr 20, 2024
2 parents eeb804d + 13bca5c commit ffc0cf5
Show file tree
Hide file tree
Showing 140 changed files with 1,007 additions and 509 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,18 @@ If you have low technical skills and you're looking to install Dolibarr ERP/CRM

Releases can be downloaded from [official website](https://www.dolibarr.org/).

### Advanced setup
### Recommended setup

You can use a web server and a supported database (MariaDB, MySQL or PostgreSQL) to install the standard version.
You can use any web server supporting PHP (Apache, Nginx, ...) and a supported database (MariaDB, MySQL or PostgreSQL) to install the standard version.

On GNU/Linux, first check if your distribution has already packaged Dolibarr.

#### Generic install steps

- Verify that your installed PHP version is supported [see PHP support](https://wiki.dolibarr.org/index.php/Releases).

- Uncompress the downloaded .zip archive to copy the `dolibarr/htdocs` directory and all its files inside your web server root or get the files directly from GitHub (recommended if you know git as it makes it easier if you want to upgrade later):

`git clone https://github.com/dolibarr/dolibarr -b x.y` (where x.y is the main version like 3.6, 9.0, ...)
`git clone https://github.com/dolibarr/dolibarr -b x.y` (where x.y is the main version like 9.0, 19.0, ...)

- Set up your web server to use `dolibarr/htdocs` as root if your web server does not already define a directory to point to.

Expand Down
2 changes: 1 addition & 1 deletion htdocs/accountancy/admin/accountmodel.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
$pageprev = $page - 1;
$pagenext = $page + 1;

$search_country_id = GETPOSTINT('search_country_id');
$search_country_id = GETPOST('search_country_id', 'int');


// Security check
Expand Down
2 changes: 1 addition & 1 deletion htdocs/accountancy/admin/categories_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
$pageprev = $page - 1;
$pagenext = $page + 1;

$search_country_id = GETPOSTINT('search_country_id');
$search_country_id = GETPOST('search_country_id', 'int');

// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('admin'));
Expand Down
17 changes: 16 additions & 1 deletion htdocs/accountancy/admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
* Actions
*/

if (in_array($action, array('setBANK_DISABLE_DIRECT_INPUT', 'setACCOUNTANCY_ER_DATE_RECORD', 'setACCOUNTANCY_COMBO_FOR_AUX', 'setACCOUNTING_MANAGE_ZERO'))) {
if (in_array($action, array('setBANK_DISABLE_DIRECT_INPUT', 'setACCOUNTANCY_ER_DATE_RECORD', 'setACCOUNTANCY_COMBO_FOR_AUX', 'setACCOUNTING_MANAGE_ZERO', 'setACCOUNTING_BANK_CONCILIATED'))) {
$constname = preg_replace('/^set/', '', $action);
$constvalue = GETPOSTINT('value');
$res = dolibarr_set_const($db, $constname, $constvalue, 'yesno', 0, '', $conf->entity);
Expand Down Expand Up @@ -405,6 +405,21 @@
print '</td>';
print '</tr>';
}

print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_BANK_CONCILIATED").'</td>';
if (getDolGlobalInt('ACCOUNTING_BANK_CONCILIATED') == 2) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_BANK_CONCILIATED&value=1">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_BANK_CONCILIATED&value=2">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';


print '</table>';
print '</div>';

Expand Down
2 changes: 1 addition & 1 deletion htdocs/accountancy/admin/journals_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@

$error = 0;

$search_country_id = GETPOSTINT('search_country_id');
$search_country_id = GETPOST('search_country_id', 'int');

// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('admin'));
Expand Down
4 changes: 2 additions & 2 deletions htdocs/accountancy/bookkeeping/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@
} else {
if (!empty($notifiedexportdate) || !empty($notifiedvalidationdate)) {
if (is_array($object->lines)) {
dol_syslog("/accountancy/bookkeeping/list.php Function export_file Specify movements as exported", LOG_DEBUG);
dol_syslog("/accountancy/bookkeeping/list.php Function export_file set movements as exported", LOG_DEBUG);

// TODO Merge update for each line into one global using rowid IN (list of movement ids)
foreach ($object->lines as $movement) {
Expand All @@ -678,7 +678,7 @@

if ($setfields) {
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
$sql .= " SET ".$db->sanitize($setfields);
$sql .= " SET ".$setfields; // $setfields is already a sanitized SQL string
$sql .= " WHERE rowid = ".((int) $movement->id);

$result = $db->query($sql);
Expand Down
4 changes: 2 additions & 2 deletions htdocs/accountancy/bookkeeping/listbyaccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -1248,7 +1248,7 @@
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'totaldebit';
}
$totalarray['val']['totaldebit'] += $line->debit;
$totalarray['val']['totaldebit'] += (float) $line->debit;
}

// Amount credit
Expand All @@ -1260,7 +1260,7 @@
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'totalcredit';
}
$totalarray['val']['totalcredit'] += $line->credit;
$totalarray['val']['totalcredit'] += (float) $line->credit;
}

// Amount balance
Expand Down
49 changes: 34 additions & 15 deletions htdocs/accountancy/journal/bankjournal.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2017-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Eric Seigne <eric.seigne@cap-rel.fr>
* Copyright (C) 2018-2024 Eric Seigne <eric.seigne@cap-rel.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
Expand Down Expand Up @@ -76,14 +76,22 @@
$date_endday = GETPOSTINT('date_endday');
$date_endyear = GETPOSTINT('date_endyear');
$in_bookkeeping = GETPOST('in_bookkeeping', 'aZ09');
if ($in_bookkeeping == '') {
$in_bookkeeping = 'notyet';

$only_rappro = GETPOSTINT('only_rappro');
if ($only_rappro == 0) {
//GET page for the first time, use default settings
$only_rappro = getDolGlobalInt('ACCOUNTING_BANK_CONCILIATED');
}

$now = dol_now();

$action = GETPOST('action', 'aZ09');

if ($in_bookkeeping == '') {
$in_bookkeeping = 'notyet';
}


// Security check
if (!isModEnabled('accounting')) {
accessforbidden();
Expand Down Expand Up @@ -165,6 +173,9 @@
if ($in_bookkeeping == 'notyet') {
$sql .= " AND (b.rowid NOT IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='bank') )";
}
if ($only_rappro == 2) {
$sql .= " AND (b.rappro = '1')";
}
$sql .= " ORDER BY b.datev";
//print $sql;

Expand Down Expand Up @@ -307,6 +318,8 @@

// Load of url links to the line into llx_bank (so load llx_bank_url)
$links = $object->get_url($obj->rowid); // Get an array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> )
// print '<p>' . json_encode($object) . "</p>";//exit;
// print '<p>' . json_encode($links) . "</p>";//exit;

// By default
$tabpay[$obj->rowid]['type'] = 'unknown'; // Can be SOLD, miscellaneous entry, payment of patient, or any old record with no links in bank_url.
Expand Down Expand Up @@ -434,30 +447,30 @@
$resultmid = $db->query($sqlmid);
if ($resultmid) {
$objmid = $db->fetch_object($resultmid);
$tabtp[$obj->rowid][$objmid->accountancy_code] += $amounttouse;
$tabtp[$obj->rowid][$objmid->accountancy_code] = isset($tabtp[$obj->rowid][$objmid->accountancy_code]) ? $tabtp[$obj->rowid][$objmid->accountancy_code] + $amounttouse : $amounttouse;
}
} elseif ($links[$key]['type'] == 'payment_donation') {
$paymentdonstatic->id = $links[$key]['url_id'];
$paymentdonstatic->ref = $links[$key]['url_id'];
$paymentdonstatic->fk_donation = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentdonstatic->getNomUrl(2);
$tabpay[$obj->rowid]["paymentdonationid"] = $paymentdonstatic->id;
$tabtp[$obj->rowid][$account_pay_donation] += $amounttouse;
$tabtp[$obj->rowid][$account_pay_donation] = isset($tabtp[$obj->rowid][$account_pay_donation]) ? $tabtp[$obj->rowid][$account_pay_donation] + $amounttouse : $amounttouse;
} elseif ($links[$key]['type'] == 'member') {
$paymentsubscriptionstatic->id = $links[$key]['url_id'];
$paymentsubscriptionstatic->ref = $links[$key]['url_id'];
$paymentsubscriptionstatic->label = $links[$key]['label'];
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentsubscriptionstatic->getNomUrl(2);
$tabpay[$obj->rowid]["paymentsubscriptionid"] = $paymentsubscriptionstatic->id;
$paymentsubscriptionstatic->fetch($paymentsubscriptionstatic->id);
$tabtp[$obj->rowid][$account_pay_subscription] += $amounttouse;
$tabtp[$obj->rowid][$account_pay_subscription] = isset($tabtp[$obj->rowid][$account_pay_subscription]) ? $tabtp[$obj->rowid][$account_pay_subscription] + $amounttouse : $amounttouse;
} elseif ($links[$key]['type'] == 'payment_vat') { // Payment VAT
$paymentvatstatic->id = $links[$key]['url_id'];
$paymentvatstatic->ref = $links[$key]['url_id'];
$paymentvatstatic->label = $links[$key]['label'];
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentvatstatic->getNomUrl(2);
$tabpay[$obj->rowid]["paymentvatid"] = $paymentvatstatic->id;
$tabtp[$obj->rowid][$account_pay_vat] += $amounttouse;
$tabtp[$obj->rowid][$account_pay_vat] = isset($tabtp[$obj->rowid][$account_pay_vat]) ? $tabtp[$obj->rowid][$account_pay_vat] + $amounttouse : $amounttouse;
} elseif ($links[$key]['type'] == 'payment_salary') {
$paymentsalstatic->id = $links[$key]['url_id'];
$paymentsalstatic->ref = $links[$key]['url_id'];
Expand Down Expand Up @@ -516,7 +529,7 @@
$account_various = (!empty($paymentvariousstatic->accountancy_code) ? $paymentvariousstatic->accountancy_code : 'NotDefined'); // NotDefined is a reserved word
$account_subledger = (!empty($paymentvariousstatic->subledger_account) ? $paymentvariousstatic->subledger_account : ''); // NotDefined is a reserved word
$tabpay[$obj->rowid]["account_various"] = $account_various;
$tabtp[$obj->rowid][$account_subledger] += $amounttouse;
$tabtp[$obj->rowid][$account_subledger] = isset($tabtp[$obj->rowid][$account_subledger]) ? $tabtp[$obj->rowid][$account_subledger] + $amounttouse : $amounttouse;
} elseif ($links[$key]['type'] == 'payment_loan') {
$paymentloanstatic->id = $links[$key]['url_id'];
$paymentloanstatic->ref = $links[$key]['url_id'];
Expand All @@ -532,14 +545,14 @@
$resultmid = $db->query($sqlmid);
if ($resultmid) {
$objmid = $db->fetch_object($resultmid);
$tabtp[$obj->rowid][$objmid->accountancy_account_capital] -= $objmid->amount_capital;
$tabtp[$obj->rowid][$objmid->accountancy_account_insurance] -= $objmid->amount_insurance;
$tabtp[$obj->rowid][$objmid->accountancy_account_interest] -= $objmid->amount_interest;
$tabtp[$obj->rowid][$objmid->accountancy_account_capital] = isset($tabtp[$obj->rowid][$objmid->accountancy_account_capital]) ? $tabtp[$obj->rowid][$objmid->accountancy_account_capital] - $objmid->amount_capital : $amounttouse;
$tabtp[$obj->rowid][$objmid->accountancy_account_insurance] = isset($tabtp[$obj->rowid][$objmid->accountancy_account_insurance]) ? $tabtp[$obj->rowid][$objmid->accountancy_account_insurance] - $objmid->amount_insurance : $amounttouse;
$tabtp[$obj->rowid][$objmid->accountancy_account_interest] = isset($tabtp[$obj->rowid][$objmid->accountancy_account_interest]) ? $tabtp[$obj->rowid][$objmid->accountancy_account_interest] - $objmid->amount_interes : $amounttouse;
}
} elseif ($links[$key]['type'] == 'banktransfert') {
$accountLinestatic->fetch($links[$key]['url_id']);
$tabpay[$obj->rowid]["lib"] .= ' '.$langs->trans("BankTransfer").'- '.$accountLinestatic ->getNomUrl(1);
$tabtp[$obj->rowid][$account_transfer] += $amounttouse;
$tabtp[$obj->rowid][$account_transfer] = isset($tabtp[$obj->rowid][$account_transfer]) ? $tabtp[$obj->rowid][$account_transfer] + $amounttouse : $amounttouse;
$bankaccountstatic->fetch($tabpay[$obj->rowid]['fk_bank_account']);
$tabpay[$obj->rowid]["soclib"] = $bankaccountstatic->getNomUrl(2);
}
Expand Down Expand Up @@ -1095,7 +1108,13 @@
$periodlink = '';
$exportlink = '';

journalHead($nom, '', $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
$listofchoices = array(
1 => $langs->trans("TransfertAllBankLines"),
2 => $langs->trans("TransfertOnlyConciliatedBankLine")
);
$moreoptions = [ "BankLineConciliated" => $form->selectarray('only_rappro', $listofchoices, $only_rappro)];

journalHead($nom, '', $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink, $moreoptions);

$desc = '';

Expand Down Expand Up @@ -1273,12 +1292,12 @@ function writebookkeeping() {
if ($mt) {
$reflabel = '';
if (!empty($val['lib'])) {
$reflabel .= $val['lib'].($val['soclib'] ? " - " : "");
$reflabel .= $val['lib'].(isset($val['soclib']) ? " - " : "");
}
if ($tabtype[$key] == 'banktransfert') {
$reflabel .= $langs->trans('TransitionalAccount').' '.$account_transfer;
} else {
$reflabel .= $val['soclib'];
$reflabel .= isset($val['soclib']) ? $val['soclib'] : "";
}

print '<!-- Thirdparty bank.rowid='.$key.' -->';
Expand Down
16 changes: 8 additions & 8 deletions htdocs/accountancy/journal/purchasesjournal.php
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@
}

// Error if some lines are not binded/ready to be journalized
if ($errorforinvoice[$key] == 'somelinesarenotbound') {
if (isset($errorforinvoice[$key]) && $errorforinvoice[$key] == 'somelinesarenotbound') {
$error++;
$errorforline++;
setEventMessages($langs->trans('ErrorInvoiceContainsLinesNotYetBounded', $val['ref']), null, 'errors');
Expand Down Expand Up @@ -598,7 +598,7 @@
if ($numtax == 2) {
$arrayofvat = $tabrclocaltax2;
}
if (!is_array($arrayofvat[$key])) {
if (!isset($arrayofvat[$key]) || !is_array($arrayofvat[$key])) {
$arrayofvat[$key] = array();
}
}
Expand Down Expand Up @@ -659,7 +659,7 @@

// Counterpart of VAT for VAT NPR
// var_dump($tabother);
if (!$errorforline && is_array($tabother[$key])) {
if (!$errorforline && isset($tabother[$key]) && is_array($tabother[$key])) {
foreach ($tabother[$key] as $k => $mt) {
if ($mt) {
$bookkeeping = new BookKeeping($db);
Expand Down Expand Up @@ -871,7 +871,7 @@
if ($numtax == 2) {
$arrayofvat = $tabrclocaltax2;
}
if (!is_array($arrayofvat[$key])) {
if (!isset($arrayofvat[$key]) || !is_array($arrayofvat[$key])) {
$arrayofvat[$key] = array();
}
}
Expand All @@ -896,7 +896,7 @@
}

// VAT counterpart for NPR
if (is_array($tabother[$key])) {
if (isset($tabother[$key]) && is_array($tabother[$key])) {
foreach ($tabother[$key] as $k => $mt) {
if ($mt) {
print '"'.$key.'"'.$sep;
Expand Down Expand Up @@ -1073,7 +1073,7 @@ function writebookkeeping() {
$i++;
continue;
}
if ($errorforinvoice[$key] == 'somelinesarenotbound') {
if (isset($errorforinvoice[$key]) && $errorforinvoice[$key] == 'somelinesarenotbound') {
print '<tr class="oddeven">';
print "<!-- Some lines are not bound -->";
print "<td>".$date."</td>";
Expand Down Expand Up @@ -1192,7 +1192,7 @@ function writebookkeeping() {
if ($numtax == 2) {
$arrayofvat = $tabrclocaltax2;
}
if (!is_array($arrayofvat[$key])) {
if (!isset($arrayofvat[$key]) || !is_array($arrayofvat[$key])) {
$arrayofvat[$key] = array();
}
}
Expand Down Expand Up @@ -1229,7 +1229,7 @@ function writebookkeeping() {
}

// VAT counterpart for NPR
if (is_array($tabother[$key])) {
if (isset($tabother[$key]) && is_array($tabother[$key])) {
foreach ($tabother[$key] as $k => $mt) {
if ($mt) {
print '<tr class="oddeven">';
Expand Down
12 changes: 6 additions & 6 deletions htdocs/accountancy/journal/sellsjournal.php
Original file line number Diff line number Diff line change
Expand Up @@ -463,15 +463,15 @@
}

// Error if some lines are not binded/ready to be journalized
if ($errorforinvoice[$key] == 'somelinesarenotbound') {
if (isset($errorforinvoice[$key]) && $errorforinvoice[$key] == 'somelinesarenotbound') {
$error++;
$errorforline++;
setEventMessages($langs->trans('ErrorInvoiceContainsLinesNotYetBounded', $val['ref']), null, 'errors');
}

// Warranty
if (!$errorforline) {
if (is_array($tabwarranty[$key])) {
if (isset($tabwaranty[$key]) && is_array($tabwarranty[$key])) {
foreach ($tabwarranty[$key] as $k => $mt) {
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
Expand Down Expand Up @@ -713,7 +713,7 @@

// Revenue stamp
if (!$errorforline) {
if (is_array($tabrevenuestamp[$key])) {
if (isset($tabrevenuestamp[$key]) && is_array($tabrevenuestamp[$key])) {
foreach ($tabrevenuestamp[$key] as $k => $mt) {
if ($mt) {
$accountingaccount->fetch(null, $k, true); // TODO Use a cache for label
Expand Down Expand Up @@ -1129,7 +1129,7 @@ function writebookkeeping() {
$i++;
continue;
}
if ($errorforinvoice[$key] == 'somelinesarenotbound') {
if (isset($errorforinvoice[$key]) && $errorforinvoice[$key] == 'somelinesarenotbound') {
print '<tr class="oddeven">';
print "<!-- Some lines are not bound -->";
print "<td>".$date."</td>";
Expand All @@ -1151,7 +1151,7 @@ function writebookkeeping() {
}

// Warranty
if (is_array($tabwarranty[$key])) {
if (isset($tabwaranty[$key]) && is_array($tabwarranty[$key])) {
foreach ($tabwarranty[$key] as $k => $mt) {
print '<tr class="oddeven">';
print "<!-- Thirdparty warranty -->";
Expand Down Expand Up @@ -1299,7 +1299,7 @@ function writebookkeeping() {
}

// Revenue stamp
if (is_array($tabrevenuestamp[$key])) {
if (isset($tabrevenuestamp[$key]) && is_array($tabrevenuestamp[$key])) {
foreach ($tabrevenuestamp[$key] as $k => $mt) {
print '<tr class="oddeven">';
print "<!-- Thirdparty revenuestamp -->";
Expand Down
Loading

0 comments on commit ffc0cf5

Please sign in to comment.