mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-07 18:18:18 +01:00
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into
develop
This commit is contained in:
11
.github/workflows/windows-ci.yml
vendored
11
.github/workflows/windows-ci.yml
vendored
@@ -36,11 +36,6 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup MariaDB
|
||||
uses: frederic34/setup-mariadb@v1
|
||||
with:
|
||||
# mariadb-version: ${{ matrix.mariadb-version }}
|
||||
database: travis # Specify your database name
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
@@ -79,6 +74,12 @@ jobs:
|
||||
${{ env.KEY_ROOT }}-${{ env.HASH }}-
|
||||
${{ env.KEY_ROOT }}-
|
||||
|
||||
- name: Setup MariaDB
|
||||
uses: frederic34/setup-mariadb@v1
|
||||
with:
|
||||
# mariadb-version: ${{ matrix.mariadb-version }}
|
||||
database: travis # Specify your database name
|
||||
|
||||
- name: Create local php.ini with open_basedir restrictions
|
||||
shell: cmd
|
||||
# Objective: separate step, and before database initialisation to verify open_basedir restrictions
|
||||
|
||||
@@ -278,8 +278,8 @@ class Categories extends DolibarrApi
|
||||
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if (!$this->category->delete(DolibarrApiAccess::$user)) {
|
||||
throw new RestException(500, 'error when delete category');
|
||||
if ($this->category->delete(DolibarrApiAccess::$user) <= 0) {
|
||||
throw new RestException(500, 'Error when delete category : ' . $this->category->error);
|
||||
}
|
||||
|
||||
return array(
|
||||
|
||||
@@ -3409,14 +3409,14 @@ class Form
|
||||
$labeltoshowhtmlstock = '';
|
||||
if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) {
|
||||
if ($user->hasRight('stock', 'lire')) {
|
||||
$labeltoshowstock .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'));
|
||||
$labeltoshowstock .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0);
|
||||
|
||||
if ($objp->stock > 0) {
|
||||
$labeltoshowhtmlstock .= ' - <span class="product_line_stock_ok">';
|
||||
} elseif ($objp->stock <= 0) {
|
||||
$labeltoshowhtmlstock .= ' - <span class="product_line_stock_too_low">';
|
||||
}
|
||||
$labeltoshowhtmlstock .= $langs->transnoentities("Stock") . ': ' . price(price2num($objp->stock, 'MS'));
|
||||
$labeltoshowhtmlstock .= $langs->transnoentities("Stock") . ': ' . price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0);
|
||||
$labeltoshowhtmlstock .= '</span>';
|
||||
|
||||
if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) { // Warning, this option may slow down combo list generation
|
||||
@@ -3555,7 +3555,6 @@ class Form
|
||||
$outdefault_vat_code = $objp->default_vat_code;
|
||||
}
|
||||
|
||||
|
||||
// Build options
|
||||
$opt = '<option value="' . $objp->rowid . '"';
|
||||
$opt .= ($objp->rowid == $selected) ? ' selected' : '';
|
||||
@@ -3980,7 +3979,7 @@ class Form
|
||||
$novirtualstock = ($showstockinlist == 2);
|
||||
|
||||
if ($user->hasRight('stock', 'lire')) {
|
||||
$outvallabel .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'));
|
||||
$outvallabel .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0);
|
||||
|
||||
if ($objp->stock > 0) {
|
||||
$optlabel .= ' - <span class="product_line_stock_ok">';
|
||||
|
||||
@@ -6732,10 +6732,11 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
|
||||
if (dol_strlen($decpart) > $nbdecimal) {
|
||||
$nbdecimal = dol_strlen($decpart);
|
||||
}
|
||||
// Si on depasse max
|
||||
$max_nbdecimal = (int) str_replace('...', '', getDolGlobalString('MAIN_MAX_DECIMALS_SHOWN'));
|
||||
if ($trunc && $nbdecimal > $max_nbdecimal) {
|
||||
$nbdecimal = $max_nbdecimal;
|
||||
|
||||
// If nbdecimal is higher than max to show
|
||||
$nbdecimalmaxshown = (int) str_replace('...', '', getDolGlobalString('MAIN_MAX_DECIMALS_SHOWN'));
|
||||
if ($trunc && $nbdecimal > $nbdecimalmaxshown) {
|
||||
$nbdecimal = $nbdecimalmaxshown;
|
||||
if (preg_match('/\.\.\./i', getDolGlobalString('MAIN_MAX_DECIMALS_SHOWN'))) {
|
||||
// If output is truncated, we show ...
|
||||
$end = '...';
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2024 Mikko Virtanen
|
||||
*
|
||||
* 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
|
||||
@@ -37,16 +38,16 @@ function dolFICalculatePaymentReference($invoice_number, $statut, $use_rf)
|
||||
{
|
||||
if ($statut >= 1) {
|
||||
$invoice_number = preg_replace('/[^0-9]/', '', $invoice_number); // Keep only numbers
|
||||
$invoice_number = ltrim($invoice_number, '0'); //Remove any leading zero or zeros
|
||||
$invoice_number = strrev($invoice_number); // Reverse the reference number
|
||||
$coefficients = array(7, 3, 1, 7, 3); // Define the coefficient numbers
|
||||
$invoice_number = ltrim($invoice_number, '0'); // Remove leading zeros
|
||||
$coefficients = array(7, 3, 1); // Define the coefficient numbers (rotating 7, 3, 1)
|
||||
$sum = 0;
|
||||
$stlen_invoice_number = (int) strlen($invoice_number);
|
||||
for ($i = 0; $i < $stlen_invoice_number; $i++) { // Calculate the sum using coefficients
|
||||
$sum += (int) $invoice_number[$i] * $coefficients[$i % 5];
|
||||
// Calculate the weighted sum from right to left
|
||||
for ($i = 0; $i < $stlen_invoice_number; $i++) {
|
||||
$sum += (int) $invoice_number[$stlen_invoice_number - $i - 1] * $coefficients[$i % 3];
|
||||
}
|
||||
$check_digit = (10 - ($sum % 10)) % 10; // Calculate the check digit
|
||||
$bank_reference_fi = strrev($invoice_number) . $check_digit; // Concatenate the Reversed reference number and the check digit
|
||||
$bank_reference_fi = $invoice_number . $check_digit; // Concatenate the reference number and the check digit
|
||||
if ($use_rf) { // SEPA RF creditor reference
|
||||
$reference_with_suffix = $bank_reference_fi . "271500"; // Append "271500" to the end of the payment reference number
|
||||
$remainder = (int) bcmod($reference_with_suffix, '97'); // Calculate the remainder when dividing by 97
|
||||
|
||||
@@ -388,7 +388,7 @@ class Contacts extends DolibarrApi
|
||||
* Delete contact
|
||||
*
|
||||
* @param int $id Contact ID
|
||||
* @return integer
|
||||
* @return array[]
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
@@ -404,7 +404,17 @@ class Contacts extends DolibarrApi
|
||||
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$this->contact->oldcopy = clone $this->contact;
|
||||
return $this->contact->delete(DolibarrApiAccess::$user);
|
||||
|
||||
if ($this->contact->delete(DolibarrApiAccess::$user) <= 0) {
|
||||
throw new RestException(500, 'Error when delete contact ' . $this->contact->error);
|
||||
}
|
||||
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'Contact deleted'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user