2
0
forked from Wavyzz/dolibarr

Compare commits

...

50 Commits
11.0.4 ... 9.0

Author SHA1 Message Date
Laurent Destailleur
90854dc2bf FIX Use the wrong logo size on PDF 2023-07-30 19:53:56 +02:00
Laurent Destailleur
b44ddaa696 FIX Use the wrong logo size on PDF 2023-07-30 18:04:03 +02:00
Laurent Destailleur
4569cb82b2 Merge branch '8.0' of git@github.com:Dolibarr/dolibarr.git into 9.0 2022-03-10 15:52:04 +01:00
Laurent Destailleur
04d33f4594 Merge branch '7.0' of git@github.com:Dolibarr/dolibarr.git into 8.0 2022-03-10 15:51:42 +01:00
Laurent Destailleur
af6e95aa79 Merge branch '6.0' of git@github.com:Dolibarr/dolibarr.git into 7.0
Conflicts:
	htdocs/core/class/utils.class.php
2022-03-10 15:49:51 +01:00
Laurent Destailleur
5d942c9d1a Fix infinit logs 2022-03-10 15:46:00 +01:00
Laurent Destailleur
1541e20870 Merge branch '8.0' of git@github.com:Dolibarr/dolibarr.git into 9.0
Conflicts:
	htdocs/core/class/utils.class.php
2022-01-07 15:43:28 +01:00
Laurent Destailleur
53709cf509 Merge branch '7.0' of git@github.com:Dolibarr/dolibarr.git into 8.0
Conflicts:
	htdocs/core/class/utils.class.php
2022-01-07 15:40:05 +01:00
Laurent Destailleur
10e32c056e FIX avoid infinite loop on dump with popen 2022-01-07 15:35:33 +01:00
Laurent Destailleur
0a72aed3d7 Fix missing space before union 2021-12-23 13:35:38 +01:00
Laurent Destailleur
5e1cd459b1 Fix travis 2020-11-15 23:47:53 +01:00
Laurent Destailleur
0f435f9901 Merge pull request #15098 from atm-gauthier/9.0_fix_worklow_order_auto_validated_with_shipping_validate_must_no_consider_services
FIX : WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING must not consider serv…
2020-10-22 16:18:11 +02:00
Laurent Destailleur
a9117fe864 Update interface_20_modWorkflow_WorkflowManager.class.php 2020-10-22 16:18:00 +02:00
Laurent Destailleur
8ce929d509 Merge pull request #15069 from ATM-Consulting/fix/9.0_linked_object_on_supplier_proposal_events
FIX 9.0 - when users create an event from a supplier proposal, the "linked objects" section says "Deleted"
2020-10-22 16:10:49 +02:00
Got2be
c2ad40043f FIX : WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING must not consider services while STOCK_SUPPORTS_SERVICES is empty 2020-10-22 16:10:47 +02:00
Florian Mortgat
529dfb8dfb FIX 9.0 - supplier proposals as linked objects of events are not correctly fetched 2020-10-20 16:37:15 +02:00
Laurent Destailleur
74eac1d06a Fix include regression 2020-08-23 19:22:01 +02:00
Laurent Destailleur
03557b69c2 Merge pull request #14486 from atm-john/9.0_fix_infinite_fetch_loop
FIX : infinite fetch object linked loop
2020-08-23 19:14:08 +02:00
Laurent Destailleur
7a183ea026 Update pdf.lib.php 2020-08-23 19:13:30 +02:00
Laurent Destailleur
b44d6744f9 Update pdf.lib.php 2020-08-23 19:11:40 +02:00
Laurent Destailleur
7eb003c684 Update pdf.lib.php 2020-08-23 19:11:19 +02:00
John Botella
6e1702c1a5 Fix infinite fetch object linked loop 2020-08-17 15:00:31 +02:00
Laurent Destailleur
73ea5b0e2d Fix function to convert price to string 2020-08-06 02:50:24 +02:00
Laurent Destailleur
9cb5735165 FIX Bad address used for vendor on PDF standard of supplier payment 2020-08-06 02:05:55 +02:00
Laurent Destailleur
c8bff3a71e FIX Cannot redeclare class 2020-08-06 02:05:04 +02:00
Laurent Destailleur
9dc904f0a5 Merge branch '8.0' of git@github.com:Dolibarr/dolibarr.git into 9.0 2020-07-29 16:03:03 +02:00
Laurent Destailleur
491f72accc Merge branch '7.0' of git@github.com:Dolibarr/dolibarr.git into 8.0 2020-07-29 16:02:07 +02:00
Laurent Destailleur
4a291f181f Fix regression 2020-07-29 13:47:04 +02:00
Laurent Destailleur
454a804b4e Merge pull request #14299 from atm-gauthier/9.0_hidden_unit
FIX : We need to see unit line on PDF even though it's an option
2020-07-29 13:18:17 +02:00
VERDOL Gauthier
25994e61bc FIX : We need to see unit line on PDF even though it's an option 2020-07-27 16:04:21 +02:00
Laurent Destailleur
4f5c5356c5 Merge pull request #14150 from atm-gauthier/9.0_deposit_amount_with_comma
FIX : create a deposit with amount using comma didn't work
2020-07-03 00:38:59 +02:00
Laurent Destailleur
18fa4c4105 Update card.php 2020-07-03 00:38:31 +02:00
gauthier
6553c40bea FIX : create a deposit with amount using comma didn't work 2020-06-30 11:23:55 +02:00
Laurent Destailleur
eb7dd74026 Revert error 2020-06-04 16:05:40 +02:00
Laurent Destailleur
88f6c71e88 Add tuto for live streaming 2020-06-04 16:05:04 +02:00
Laurent Destailleur
afacfa702d Merge pull request #13943 from atm-maxime/fix_pgsql_if
Fix SQL IF for PGSQL
2020-05-23 13:41:18 +02:00
Maxime Kohlhaas
f89195e39f Fix SQL IF for PGSQL 2020-05-21 23:23:59 +02:00
Laurent Destailleur
ca14f9a0fa Merge pull request #13901 from atm-maxime/fix_cron_globals
Fix cron globals reload, missing mysoc and langs
2020-05-18 15:02:00 +02:00
Laurent Destailleur
18a19dafe5 Update cron_run_jobs.php 2020-05-18 15:01:29 +02:00
Laurent Destailleur
3d385dd378 Merge pull request #13903 from atm-maxime/fix_actioncomm_fetch_entity
Fix : entity was missing in actioncomm fetch
2020-05-18 14:59:10 +02:00
Laurent Destailleur
2d1f151fb2 Merge pull request #13905 from atm-maxime/fix_expedition_fetch_entity
Fix : entity was missing in expedition fetch
2020-05-18 14:58:57 +02:00
Maxime Kohlhaas
3d9d5d0ad5 Fix : entity was missing in expedition fetch 2020-05-18 11:03:32 +02:00
Maxime Kohlhaas
cf96383bf9 Fix : entity was missing in actioncomm fetch 2020-05-18 10:44:55 +02:00
Maxime Kohlhaas
54af917afb Fix cron globals reload, missing mysoc and langs 2020-05-16 20:13:47 +02:00
Laurent Destailleur
e327d609d7 Merge pull request #13891 from aspangaro/9.0p1
FIX Site ec.europa.eu has moved to https://
2020-05-15 14:01:28 +02:00
Alexandre SPANGARO
3811586cd0 FIX Site ec.europa.eu has moved to https:// 2020-05-14 20:34:48 +02:00
Laurent Destailleur
cf039b26f9 Merge pull request #13887 from atm-florianm/FIX_9.0_fatal_during_migration_from_dolibarr_3.1_if_php7
FIX 9.0 - fatal during migration from 3.1 using PHP 7
2020-05-14 15:49:08 +02:00
Florian Mortgat
bd3504c473 FIX 9.0 - delete unused mandatory argument from migrate_clean_association: argument count mismatch causes a fatal error since php7 2020-05-13 10:26:44 +02:00
Laurent Destailleur
4a9c85ae39 Merge pull request #13869 from frederic34/patch-6
Fix dolistore search with csrf active
2020-05-12 02:59:06 +02:00
Frédéric FRANCE
4d50ba5e37 Fix dolistore search with csrf active 2020-05-11 20:42:47 +02:00
22 changed files with 317 additions and 240 deletions

View File

@@ -120,6 +120,7 @@ install:
composer self-update
composer -n init
composer -n config vendor-dir htdocs/includes
composer -n config -g vendor-dir htdocs/includes
echo
- |

View File

@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2017 Oscss-Shop <support@oscss-shop.fr>.
* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modifyion 2.0 (the "License");
* it under the terms of the GNU General Public License as published bypliance with the License.
@@ -17,6 +18,9 @@
*/
if (!defined('REQUIRE_JQUERY_BLOCKUI')) define('REQUIRE_JQUERY_BLOCKUI', 1);
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', 1);
}
/**

View File

@@ -572,6 +572,7 @@ class ActionComm extends CommonObject
$sql = "SELECT a.id,";
$sql.= " a.id as ref,";
$sql.= " a.entity,";
$sql.= " a.ref_ext,";
$sql.= " a.datep,";
$sql.= " a.datep2,";
@@ -608,6 +609,7 @@ class ActionComm extends CommonObject
$obj = $this->db->fetch_object($resql);
$this->id = $obj->id;
$this->entity = $obj->entity;
$this->ref = $obj->ref;
$this->ref_ext = $obj->ref_ext;

View File

@@ -1255,7 +1255,7 @@ if (empty($reshook))
if ($_POST['type'] == Facture::TYPE_DEPOSIT)
{
$typeamount = GETPOST('typedeposit', 'alpha');
$valuedeposit = GETPOST('valuedeposit', 'int');
$valuedeposit = price2num(GETPOST('valuedeposit', 'alpha'), 'MU');
$amountdeposit = array();
if (!empty($conf->global->MAIN_DEPOSIT_MULTI_TVA))

View File

@@ -365,8 +365,8 @@ else
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
$resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($resql);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0;
@@ -376,18 +376,18 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$sql.= $db->plimit($limit+1, $offset);
$result = $db->query($sql);
if (! $result)
$resql = $db->query($sql);
if (! $resql)
{
dol_print_error($db);
exit;
}
$num = $db->num_rows($result);
$num = $db->num_rows($resql);
$arrayofselected=is_array($toselect)?$toselect:array();
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($sall != '' || $seearch_cti != ''))
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($sall != '' || $search_cti != ''))
{
$obj = $db->fetch_object($resql);
$id = $obj->rowid;
@@ -715,7 +715,7 @@ $i = 0;
$totalarray=array();
while ($i < min($num,$limit))
{
$obj = $db->fetch_object($result);
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
@@ -914,7 +914,7 @@ while ($i < min($num,$limit))
$i++;
}
$db->free($result);
$db->free($resql);
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook

View File

@@ -347,17 +347,19 @@ class Utils
{
$handlein = popen($fullcommandclear, 'r');
$i=0;
while (!feof($handlein))
{
$i++; // output line number
$read = fgets($handlein);
// Exclude warning line we don't want
if ($i == 1 && preg_match('/Warning.*Using a password/i', $read)) continue;
fwrite($handle, $read);
if (preg_match('/'.preg_quote('-- Dump completed').'/i', $read)) $ok=1;
elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES').'/i', $read)) $ok=1;
if ($handlein) {
while (!feof($handlein))
{
$i++; // output line number
$read = fgets($handlein);
// Exclude warning line we don't want
if ($i == 1 && preg_match('/Warning.*Using a password/i', $read)) continue;
fwrite($handle, $read);
if (preg_match('/'.preg_quote('-- Dump completed').'/i', $read)) $ok=1;
elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES').'/i', $read)) $ok=1;
}
pclose($handlein);
}
pclose($handlein);
}

View File

@@ -1872,6 +1872,12 @@ function dolGetElementUrl($objectid,$objecttype,$withpicto=0,$option='')
$classpath = 'fourn/class';
$module='fournisseur';
}
elseif ($objecttype == 'supplier_proposal') {
$classfile = 'supplier_proposal';
$classname = 'SupplierProposal';
$classpath = 'supplier_proposal/class';
$module = 'supplier_proposal';
}
elseif ($objecttype == 'stock') {
$classpath = 'product/stock/class';
$classfile='entrepot';

View File

@@ -13,125 +13,142 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* or see https://www.gnu.org/
*/
/**
* \file htdocs/core/lib/functionsnumbertoword.lib.php
* \file htdocs/core/lib/functionsnumtoword.lib.php
* \brief A set of functions for Dolibarr
* This file contains all frequently used functions.
*/
/**
* Function to return number in text.
* Function to return a number into a text.
* May use module NUMBERWORDS if found.
*
*
* @param float $num Number to convert
* @param Lang $langs Language
* @param boolean $currency 0=number to translate | 1=currency to translate
* @param boolean $centimes 0=no centimes | 1=centimes to translate
* @return string Text of the number
* @param float $num Number to convert (must be a numeric value, like reported by price2num())
* @param Translate $langs Language
* @param boolean $currency 0=number to translate | 1=currency to translate
* @param boolean $centimes 0=no cents/centimes | 1=there is cents/centimes to translate
* @return string|false Text of the number
*/
function dol_convertToWord($num, $langs, $currency=false, $centimes=false)
function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
{
global $conf;
$num = str_replace(array(',', ' '), '', trim($num));
if(! $num) {
return false;
}
if($centimes && strlen($num) == 1) {
$num = $num*10;
}
$TNum = explode('.',$num);
$num = (int) $TNum[0];
$words = array();
$list1 = array(
'',
$langs->transnoentitiesnoconv('one'),
$langs->transnoentitiesnoconv('two'),
$langs->transnoentitiesnoconv('three'),
$langs->transnoentitiesnoconv('four'),
$langs->transnoentitiesnoconv('five'),
$langs->transnoentitiesnoconv('six'),
$langs->transnoentitiesnoconv('seven'),
$langs->transnoentitiesnoconv('eight'),
$langs->transnoentitiesnoconv('nine'),
$langs->transnoentitiesnoconv('ten'),
$langs->transnoentitiesnoconv('eleven'),
$langs->transnoentitiesnoconv('twelve'),
$langs->transnoentitiesnoconv('thirteen'),
$langs->transnoentitiesnoconv('fourteen'),
$langs->transnoentitiesnoconv('fifteen'),
$langs->transnoentitiesnoconv('sixteen'),
$langs->transnoentitiesnoconv('seventeen'),
$langs->transnoentitiesnoconv('eighteen'),
$langs->transnoentitiesnoconv('nineteen')
);
$list2 = array(
'',
$langs->transnoentitiesnoconv('ten'),
$langs->transnoentitiesnoconv('twenty'),
$langs->transnoentitiesnoconv('thirty'),
$langs->transnoentitiesnoconv('forty'),
$langs->transnoentitiesnoconv('fifty'),
$langs->transnoentitiesnoconv('sixty'),
$langs->transnoentitiesnoconv('seventy'),
$langs->transnoentitiesnoconv('eighty'),
$langs->transnoentitiesnoconv('ninety'),
$langs->transnoentitiesnoconv('hundred')
);
$list3 = array(
'',
$langs->transnoentitiesnoconv('thousand'),
$langs->transnoentitiesnoconv('million'),
$langs->transnoentitiesnoconv('billion'),
$langs->transnoentitiesnoconv('trillion'),
$langs->transnoentitiesnoconv('quadrillion')
);
$num_length = strlen($num);
$levels = (int) (($num_length + 2) / 3);
$max_length = $levels * 3;
$num = substr('00' . $num, -$max_length);
$num_levels = str_split($num, 3);
$nboflevels = count($num_levels);
for ($i = 0; $i < $nboflevels; $i++) {
$levels--;
$hundreds = (int) ($num_levels[$i] / 100);
$hundreds = ($hundreds ? ' ' . $list1[$hundreds] . ' '.$langs->transnoentities('hundred') . ( $hundreds == 1 ? '' : 's' ) . ' ': '');
$tens = (int) ($num_levels[$i] % 100);
$singles = '';
if ( $tens < 20 ) {
$tens = ($tens ? ' ' . $list1[$tens] . ' ' : '' );
} else {
$tens = (int) ($tens / 10);
$tens = ' ' . $list2[$tens] . ' ';
$singles = (int) ($num_levels[$i] % 10);
$singles = ' ' . $list1[$singles] . ' ';
}
$words[] = $hundreds . $tens . $singles . ( ( $levels && ( int ) ( $num_levels[$i] ) ) ? ' ' . $list3[$levels] . ' ' : '' );
} //end for loop
$commas = count($words);
if ($commas > 1) {
$commas = $commas - 1;
}
$concatWords = implode(' ', $words);
// Delete multi whitespaces
$concatWords = trim(preg_replace('/[ ]+/', ' ', $concatWords));
if(!empty($currency)) {
$concatWords .= ' '.$currency;
//$num = str_replace(array(',', ' '), '', trim($num)); This should be useless since $num MUST be a php numeric value
if (!$num) {
return false;
}
// If we need to write cents call again this function for cents
if(!empty($TNum[1])) {
if(!empty($currency)) $concatWords .= ' '.$langs->transnoentities('and');
$concatWords .= ' '.dol_convertToWord($TNum[1], $langs, $currency, true);
if(!empty($currency)) $concatWords .= ' '.$langs->transnoentities('centimes');
if ($centimes && strlen($num) == 1) {
$num = $num * 10;
}
if (!empty($conf->global->MAIN_MODULE_NUMBERWORDS)) {
if ($currency) {
$type = 1;
} else {
$type = 0;
}
$concatWords = $langs->getLabelFromNumber($num, $type);
return $concatWords;
} else {
$TNum = explode('.', $num);
$num = (int) $TNum[0];
$words = array();
$list1 = array(
'',
$langs->transnoentitiesnoconv('one'),
$langs->transnoentitiesnoconv('two'),
$langs->transnoentitiesnoconv('three'),
$langs->transnoentitiesnoconv('four'),
$langs->transnoentitiesnoconv('five'),
$langs->transnoentitiesnoconv('six'),
$langs->transnoentitiesnoconv('seven'),
$langs->transnoentitiesnoconv('eight'),
$langs->transnoentitiesnoconv('nine'),
$langs->transnoentitiesnoconv('ten'),
$langs->transnoentitiesnoconv('eleven'),
$langs->transnoentitiesnoconv('twelve'),
$langs->transnoentitiesnoconv('thirteen'),
$langs->transnoentitiesnoconv('fourteen'),
$langs->transnoentitiesnoconv('fifteen'),
$langs->transnoentitiesnoconv('sixteen'),
$langs->transnoentitiesnoconv('seventeen'),
$langs->transnoentitiesnoconv('eighteen'),
$langs->transnoentitiesnoconv('nineteen')
);
$list2 = array(
'',
$langs->transnoentitiesnoconv('ten'),
$langs->transnoentitiesnoconv('twenty'),
$langs->transnoentitiesnoconv('thirty'),
$langs->transnoentitiesnoconv('forty'),
$langs->transnoentitiesnoconv('fifty'),
$langs->transnoentitiesnoconv('sixty'),
$langs->transnoentitiesnoconv('seventy'),
$langs->transnoentitiesnoconv('eighty'),
$langs->transnoentitiesnoconv('ninety'),
$langs->transnoentitiesnoconv('hundred')
);
$list3 = array(
'',
$langs->transnoentitiesnoconv('thousand'),
$langs->transnoentitiesnoconv('million'),
$langs->transnoentitiesnoconv('billion'),
$langs->transnoentitiesnoconv('trillion'),
$langs->transnoentitiesnoconv('quadrillion')
);
$num_length = strlen($num);
$levels = (int) (($num_length + 2) / 3);
$max_length = $levels * 3;
$num = substr('00'.$num, -$max_length);
$num_levels = str_split($num, 3);
$nboflevels = count($num_levels);
for ($i = 0; $i < $nboflevels; $i++) {
$levels--;
$hundreds = (int) ($num_levels[$i] / 100);
$hundreds = ($hundreds ? ' '.$list1[$hundreds].' '.$langs->transnoentities('hundred').($hundreds == 1 ? '' : 's').' ' : '');
$tens = (int) ($num_levels[$i] % 100);
$singles = '';
if ($tens < 20) {
$tens = ($tens ? ' '.$list1[$tens].' ' : '');
} else {
$tens = (int) ($tens / 10);
$tens = ' '.$list2[$tens].' ';
$singles = (int) ($num_levels[$i] % 10);
$singles = ' '.$list1[$singles].' ';
}
$words[] = $hundreds.$tens.$singles.(($levels && (int) ($num_levels[$i])) ? ' '.$list3[$levels].' ' : '');
} //end for loop
$commas = count($words);
if ($commas > 1) {
$commas = $commas - 1;
}
$concatWords = implode(' ', $words);
// Delete multi whitespaces
$concatWords = trim(preg_replace('/[ ]+/', ' ', $concatWords));
if (!empty($currency)) {
$concatWords .= ' '.$currency;
}
// If we need to write cents call again this function for cents
$decimalpart = $TNum[1];
$decimalpart = preg_replace('/0+$/', '', $decimalpart);
if ($decimalpart) {
if (!empty($currency)) $concatWords .= ' '.$langs->transnoentities('and');
$concatWords .= ' '.dol_convertToWord($decimalpart, $langs, '', true);
if (!empty($currency)) $concatWords .= ' '.$langs->transnoentities('centimes');
}
return $concatWords;
}
return $concatWords;
}
@@ -139,92 +156,92 @@ function dol_convertToWord($num, $langs, $currency=false, $centimes=false)
* Function to return number or amount in text.
*
* @deprecated
* @param float $numero Number to convert
* @param Lang $langs Language
* @param string $numorcurrency 'number' or 'amount'
* @return string Text of the number or -1 in case TOO LONG (more than 1000000000000.99)
* @param float $numero Number to convert
* @param Translate $langs Language
* @param string $numorcurrency 'number' or 'amount'
* @return string Text of the number or -1 in case TOO LONG (more than 1000000000000.99)
*/
function dolNumberToWord($numero, $langs, $numorcurrency='number')
function dolNumberToWord($numero, $langs, $numorcurrency = 'number')
{
// If the number is negative convert to positive and return -1 if is too long
if ($numero < 0) $numero *= -1;
if ($numero >= 1000000000001)
return -1;
// Get 2 decimals to cents, another functions round or truncate
$strnumber = number_format ($numero,10);
$len=strlen($strnumber);
for ($i=0; $i<$len; $i++)
{
if ($strnumber[$i]=='.') {
$parte_decimal = $strnumber[$i+1].$strnumber[$i+2];
break;
// Get 2 decimals to cents, another functions round or truncate
$strnumber = number_format($numero, 10);
$len = strlen($strnumber);
for ($i = 0; $i < $len; $i++)
{
if ($strnumber[$i] == '.') {
$parte_decimal = $strnumber[$i + 1].$strnumber[$i + 2];
break;
}
}
}
/*In dolibarr 3.6.2 (my current version) doesn't have $langs->default and
in case exist why ask $lang like a parameter?*/
if (((is_object($langs) && $langs->default == 'es_MX') || (! is_object($langs) && $langs == 'es_MX')) && $numorcurrency == 'currency')
{
if ($numero>=1 && $numero<2) {
return ("UN PESO ".$parte_decimal." / 100 M.N.");
}
elseif ($numero>=0 && $numero<1){
return ("CERO PESOS ".$parte_decimal." / 100 M.N.");
}
elseif ($numero>=1000000 && $numero<1000001){
return ("UN MILL&OacuteN DE PESOS ".$parte_decimal." / 100 M.N.");
}
elseif ($numero>=1000000000000 && $numero<1000000000001){
return ("UN BILL&OacuteN DE PESOS ".$parte_decimal." / 100 M.N.");
}
else {
$entexto ="";
$number = $numero;
if ($number >= 1000000000){
$CdMMillon = (int) ($numero / 100000000000);
$numero = $numero - $CdMMillon * 100000000000;
$DdMMillon = (int) ($numero / 10000000000);
$numero = $numero - $DdMMillon * 10000000000;
$UdMMillon = (int) ($numero / 1000000000);
$numero = $numero - $UdMMillon * 1000000000;
$entexto .= hundreds2text ($CdMMillon, $DdMMillon, $UdMMillon);
$entexto .= " MIL ";
/*In dolibarr 3.6.2 (my current version) doesn't have $langs->default and
in case exist why ask $lang like a parameter?*/
if (((is_object($langs) && $langs->default == 'es_MX') || (!is_object($langs) && $langs == 'es_MX')) && $numorcurrency == 'currency')
{
if ($numero >= 1 && $numero < 2) {
return ("UN PESO ".$parte_decimal." / 100 M.N.");
}
if ($number >= 1000000){
$CdMILLON = (int) ($numero / 100000000);
$numero = $numero - $CdMILLON * 100000000;
$DdMILLON = (int) ($numero / 10000000);
$numero = $numero - $DdMILLON * 10000000;
$udMILLON = (int) ($numero / 1000000);
$numero = $numero - $udMILLON * 1000000;
$entexto .= hundreds2text ($CdMILLON, $DdMILLON, $udMILLON);
if (!$CdMMillon && !$DdMMillon && !$UdMMillon && !$CdMILLON && !$DdMILLON && $udMILLON==1)
$entexto .= " MILL&OacuteN ";
else
$entexto .= " MILLONES ";
elseif ($numero >= 0 && $numero < 1) {
return ("CERO PESOS ".$parte_decimal." / 100 M.N.");
}
if ($number >= 1000) {
$cdm = (int) ($numero / 100000);
$numero = $numero - $cdm * 100000;
$ddm = (int) ($numero / 10000);
$numero = $numero - $ddm * 10000;
$udm = (int) ($numero / 1000);
$numero = $numero - $udm * 1000;
$entexto .= hundreds2text ($cdm, $ddm, $udm);
if ($cdm || $ddm || $udm)
elseif ($numero >= 1000000 && $numero < 1000001) {
return ("UN MILL&OacuteN DE PESOS ".$parte_decimal." / 100 M.N.");
}
elseif ($numero >= 1000000000000 && $numero < 1000000000001) {
return ("UN BILL&OacuteN DE PESOS ".$parte_decimal." / 100 M.N.");
}
else {
$entexto = "";
$number = $numero;
if ($number >= 1000000000) {
$CdMMillon = (int) ($numero / 100000000000);
$numero = $numero - $CdMMillon * 100000000000;
$DdMMillon = (int) ($numero / 10000000000);
$numero = $numero - $DdMMillon * 10000000000;
$UdMMillon = (int) ($numero / 1000000000);
$numero = $numero - $UdMMillon * 1000000000;
$entexto .= hundreds2text($CdMMillon, $DdMMillon, $UdMMillon);
$entexto .= " MIL ";
}
if ($number >= 1000000) {
$CdMILLON = (int) ($numero / 100000000);
$numero = $numero - $CdMILLON * 100000000;
$DdMILLON = (int) ($numero / 10000000);
$numero = $numero - $DdMILLON * 10000000;
$udMILLON = (int) ($numero / 1000000);
$numero = $numero - $udMILLON * 1000000;
$entexto .= hundreds2text($CdMILLON, $DdMILLON, $udMILLON);
if (!$CdMMillon && !$DdMMillon && !$UdMMillon && !$CdMILLON && !$DdMILLON && $udMILLON == 1)
$entexto .= " MILL&OacuteN ";
else
$entexto .= " MILLONES ";
}
if ($number >= 1000) {
$cdm = (int) ($numero / 100000);
$numero = $numero - $cdm * 100000;
$ddm = (int) ($numero / 10000);
$numero = $numero - $ddm * 10000;
$udm = (int) ($numero / 1000);
$numero = $numero - $udm * 1000;
$entexto .= hundreds2text($cdm, $ddm, $udm);
if ($cdm || $ddm || $udm)
$entexto .= " MIL ";
}
$c = (int) ($numero / 100);
$numero = $numero - $c * 100;
$d = (int) ($numero / 10);
$u = (int) $numero - $d * 10;
$entexto .= hundreds2text($c, $d, $u);
if (!$cdm && !$ddm && !$udm && !$c && !$d && !$u && $number > 1000000)
$entexto .= " DE";
$entexto .= " PESOS ".$parte_decimal." / 100 M.N.";
}
$c = (int) ($numero / 100);
$numero = $numero - $c * 100;
$d = (int) ($numero / 10);
$u = (int) $numero - $d * 10;
$entexto .= hundreds2text ($c, $d, $u);
if (!$cdm && !$ddm && !$udm && !$c && !$d && !$u && $number>1000000)
$entexto .= " DE";
$entexto .= " PESOS ".$parte_decimal." / 100 M.N.";
return $entexto;
}
return $entexto;
}
}
/**
@@ -237,40 +254,40 @@ function dolNumberToWord($numero, $langs, $numorcurrency='number')
*/
function hundreds2text($hundreds, $tens, $units)
{
if ($hundreds==1 && $tens==0 && $units==0){
if ($hundreds == 1 && $tens == 0 && $units == 0) {
return "CIEN";
}
$centenas = array("CIENTO","DOSCIENTOS","TRESCIENTOS","CUATROCIENTOS","QUINIENTOS","SEISCIENTOS","SETECIENTOS","OCHOCIENTOS","NOVECIENTOS");
$decenas = array("","","TREINTA ","CUARENTA ","CINCUENTA ","SESENTA ","SETENTA ","OCHENTA ","NOVENTA ");
$veintis = array("VEINTE","VEINTIUN","VEINTID&OacuteS","VEINTITR&EacuteS","VEINTICUATRO","VEINTICINCO","VEINTIS&EacuteIS","VEINTISIETE","VEINTIOCHO","VEINTINUEVE");
$diecis = array("DIEZ","ONCE","DOCE","TRECE","CATORCE","QUINCE","DIECIS&EacuteIS","DIECISIETE","DIECIOCHO","DIECINUEVE");
$unidades = array("UN","DOS","TRES","CUATRO","CINCO","SEIS","SIETE","OCHO","NUEVE");
$centenas = array("CIENTO", "DOSCIENTOS", "TRESCIENTOS", "CUATROCIENTOS", "QUINIENTOS", "SEISCIENTOS", "SETECIENTOS", "OCHOCIENTOS", "NOVECIENTOS");
$decenas = array("", "", "TREINTA ", "CUARENTA ", "CINCUENTA ", "SESENTA ", "SETENTA ", "OCHENTA ", "NOVENTA ");
$veintis = array("VEINTE", "VEINTIUN", "VEINTID&OacuteS", "VEINTITR&EacuteS", "VEINTICUATRO", "VEINTICINCO", "VEINTIS&EacuteIS", "VEINTISIETE", "VEINTIOCHO", "VEINTINUEVE");
$diecis = array("DIEZ", "ONCE", "DOCE", "TRECE", "CATORCE", "QUINCE", "DIECIS&EacuteIS", "DIECISIETE", "DIECIOCHO", "DIECINUEVE");
$unidades = array("UN", "DOS", "TRES", "CUATRO", "CINCO", "SEIS", "SIETE", "OCHO", "NUEVE");
$entexto = "";
if ($hundreds!=0){
$entexto .= $centenas[$hundreds-1];
if ($hundreds != 0) {
$entexto .= $centenas[$hundreds - 1];
}
if ($tens>2){
if ($hundreds!=0) $entexto .= " ";
$entexto .= $decenas[$tens-1];
if ($units!=0){
if ($tens > 2) {
if ($hundreds != 0) $entexto .= " ";
$entexto .= $decenas[$tens - 1];
if ($units != 0) {
$entexto .= " Y ";
$entexto .= $unidades[$units-1];
$entexto .= $unidades[$units - 1];
}
return $entexto;
}
elseif ($tens==2){
if ($hundreds!=0) $entexto .= " ";
elseif ($tens == 2) {
if ($hundreds != 0) $entexto .= " ";
$entexto .= " ".$veintis[$units];
return $entexto;
}
elseif ($tens==1){
if ($hundreds!=0) $entexto .= " ";
elseif ($tens == 1) {
if ($hundreds != 0) $entexto .= " ";
$entexto .= $diecis[$units];
return $entexto;
}
if ($units!=0) {
if ($hundreds!=0 || $tens!=0) $entexto .= " ";
$entexto .= $unidades[$units-1];
if ($units != 0) {
if ($hundreds != 0 || $tens != 0) $entexto .= " ";
$entexto .= $unidades[$units - 1];
}
return $entexto;
}

View File

@@ -1826,7 +1826,6 @@ function pdf_getlineunit($object, $i, $outputlangs, $hidedetails = 0, $hookmanag
}
if (empty($reshook))
{
if ($object->lines[$i]->special_code == 3) return '';
if (empty($hidedetails) || $hidedetails > 1) $result.=$langs->transnoentitiesnoconv($object->lines[$i]->getLabelOfUnit('short'));
}
return $result;
@@ -2072,7 +2071,7 @@ function pdf_getTotalQty($object,$type,$outputlangs)
*/
function pdf_getLinkedObjects($object,$outputlangs)
{
global $hookmanager;
global $db, $hookmanager;
$linkedobjects=array();
@@ -2128,8 +2127,13 @@ function pdf_getLinkedObjects($object,$outputlangs)
// We concat this record info into fields xxx_value. title is overwrote.
if (empty($object->linkedObjects['commande']) && $object->element != 'commande') // There is not already a link to order and object is not the order, so we show also info with order
{
$elementobject->fetchObjectLinked();
if (! empty($elementobject->linkedObjects['commande'])) $order = reset($elementobject->linkedObjects['commande']);
$elementobject->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0);
if (! empty($elementobject->linkedObjectsIds['commande'])){
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$order = new Commande($db);
$ret = $order->fetch(reset($elementobject->linkedObjectsIds['commande']));
if ($ret < 1) { $order=null; }
}
}
if (! is_object($order))
{

View File

@@ -1251,9 +1251,17 @@ class pdf_einstein extends ModelePDFCommandes
// Logo
if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
{
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
if ($this->emetteur->logo)
{
$logodir = $conf->mycompany->dir_output;
if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
{
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
}
else {
$logo = $logodir.'/logos/'.$this->emetteur->logo;
}
if (is_readable($logo))
{
$height=pdf_getHeightForLogo($logo);

View File

@@ -1563,9 +1563,17 @@ class pdf_crabe extends ModelePDFFactures
// Logo
if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
{
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
if ($this->emetteur->logo)
{
$logodir = $conf->mycompany->dir_output;
if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
{
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
}
else {
$logo = $logodir.'/logos/'.$this->emetteur->logo;
}
if (is_readable($logo))
{
$height=pdf_getHeightForLogo($logo);

View File

@@ -1453,9 +1453,17 @@ class pdf_azur extends ModelePDFPropales
// Logo
if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
{
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
if ($this->emetteur->logo)
{
$logodir = $conf->mycompany->dir_output;
if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
{
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
}
else {
$logo = $logodir.'/logos/'.$this->emetteur->logo;
}
if (is_readable($logo))
{
$height=pdf_getHeightForLogo($logo);

View File

@@ -1449,9 +1449,17 @@ class pdf_cyan extends ModelePDFPropales
// Logo
if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
{
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
if ($this->emetteur->logo)
{
$logodir = $conf->mycompany->dir_output;
if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
{
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
}
else {
$logo = $logodir.'/logos/'.$this->emetteur->logo;
}
if (is_readable($logo))
{
$height=pdf_getHeightForLogo($logo);

View File

@@ -766,7 +766,9 @@ class pdf_standard extends ModelePDFSuppliersPayments
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$mysoc,((!empty($object->contact))?$object->contact:null),$usecontact,'target',$object);
$usecontact = 0;
$carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ((!empty($object->contact))?$object->contact:null), $usecontact, 'target', $object);
// Show recipient
$widthrecbox=90;

View File

@@ -299,6 +299,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
//Build array of quantity ordered by product
if (is_array($order->lines) && count($order->lines)>0) {
foreach($order->lines as $orderline) {
if (empty($conf->global->STOCK_SUPPORTS_SERVICES) && $orderline->product_type > 0) continue;
$qtyordred[$orderline->fk_product]+=$orderline->qty;
}
}

View File

@@ -527,7 +527,7 @@ class Expedition extends CommonObject
// Check parameters
if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
$sql = "SELECT e.rowid, e.ref, e.fk_soc as socid, e.date_creation, e.ref_customer, e.ref_ext, e.ref_int, e.fk_user_author, e.fk_statut, e.fk_projet, e.billed";
$sql = "SELECT e.rowid, e.entity, e.ref, e.fk_soc as socid, e.date_creation, e.ref_customer, e.ref_ext, e.ref_int, e.fk_user_author, e.fk_statut, e.fk_projet, e.billed";
$sql.= ", e.weight, e.weight_units, e.size, e.size_units, e.width, e.height";
$sql.= ", e.date_expedition as date_expedition, e.model_pdf, e.fk_address, e.date_delivery";
$sql.= ", e.fk_shipping_method, e.tracking_number";
@@ -555,6 +555,7 @@ class Expedition extends CommonObject
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
$this->entity = $obj->entity;
$this->ref = $obj->ref;
$this->socid = $obj->socid;
$this->ref_customer = $obj->ref_customer;

View File

@@ -2146,7 +2146,7 @@ class ExpenseReport extends CommonObject
$sql = "SELECT DISTINCT ur.fk_user";
$sql.= " FROM ".MAIN_DB_PREFIX."user_rights as ur, ".MAIN_DB_PREFIX."rights_def as rd";
$sql.= " WHERE ur.fk_id = rd.id and rd.module = 'expensereport' AND rd.perms = 'approve'"; // Permission 'Approve';
$sql.= "UNION";
$sql.= " UNION";
$sql.= " SELECT DISTINCT ugu.fk_user";
$sql.= " FROM ".MAIN_DB_PREFIX."usergroup_user as ugu, ".MAIN_DB_PREFIX."usergroup_rights as ur, ".MAIN_DB_PREFIX."rights_def as rd";
$sql.= " WHERE ugu.fk_usergroup = ur.fk_usergroup AND ur.fk_id = rd.id and rd.module = 'expensereport' AND rd.perms = 'approve'"; // Permission 'Approve';

View File

@@ -27,10 +27,10 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
require DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
$langs->loadLangs(array('bills', 'banks', 'companies', 'suppliers'));
@@ -210,7 +210,7 @@ if ($result > 0)
*/
// Amount
print '<tr><td colspan="2">'.$langs->trans('Amount').'</td><td colspan="3">'.price($object->montant,'',$langs,0,0,-1,$conf->currency).'</td></tr>';
print '<tr><td colspan="2">'.$langs->trans('Amount').'</td><td colspan="3">'.price($object->amount,'',$langs,0,0,-1,$conf->currency).'</td></tr>';
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
{

View File

@@ -3605,10 +3605,9 @@ function migrate_mode_reglement($db,$langs,$conf)
* @param DoliDB $db Database handler
* @param Translate $langs Object langs
* @param Conf $conf Object conf
* @param string $versionto Version target
* @return void
*/
function migrate_clean_association($db,$langs,$conf,$versionto)
function migrate_clean_association($db, $langs, $conf)
{
$result = $db->DDLDescTable(MAIN_DB_PREFIX."categorie_association");
if ($result) // result defined for version 3.2 or -

View File

@@ -136,9 +136,9 @@ if ($id > 0 || ! empty($ref))
$sql.= " f.datef, f.paye, f.fk_statut as statut, f.type,";
if (!$user->rights->societe->client->voir && !$socid) $sql.= " sc.fk_soc, sc.fk_user,";
$sql.= " sum(d.total_ht) as selling_price,"; // may be negative or positive
$sql.= " IF(f.type = 2, -1, 1) * sum(d.qty) as qty,"; // not always positive in case of Credit note
$sql.= " IF(f.type = 2, -1, 1) * sum(d.qty * d.buy_price_ht) as buying_price,"; // not always positive in case of Credit note
$sql.= " IF(f.type = 2, -1, 1) * sum(abs(d.total_ht) - (d.buy_price_ht * d.qty)) as marge" ; // not always positive in case of Credit note
$sql.= " ".$db->ifsql('f.type = 2', -1, 1)." * sum(d.qty) as qty,"; // not always positive in case of Credit note
$sql.= " ".$db->ifsql('f.type = 2', -1, 1)." * sum(d.qty * d.buy_price_ht) as buying_price,"; // not always positive in case of Credit note
$sql.= " ".$db->ifsql('f.type = 2', -1, 1)." * sum(abs(d.total_ht) - (d.buy_price_ht * d.qty)) as marge" ; // not always positive in case of Credit note
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
$sql.= ", ".MAIN_DB_PREFIX."facturedet as d";

View File

@@ -28,9 +28,9 @@ require_once NUSOAP_PATH.'/nusoap.php';
$langs->load("companies");
//http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl
$WS_DOL_URL='http://ec.europa.eu/taxation_customs/vies/services/checkVatService';
$WS_DOL_URL='https://ec.europa.eu/taxation_customs/vies/services/checkVatService';
//$WS_DOL_URL_WSDL=$WS_DOL_URL.'?wsdl';
$WS_DOL_URL_WSDL='http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl';
$WS_DOL_URL_WSDL='https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl';
$WS_METHOD ='checkVat';

View File

@@ -191,11 +191,12 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs)>0))
// Force reload of setup for the current entity
if ($line->entity != $conf->entity)
{
dol_syslog("cron_run_jobs.php we work on another entity so we reload user and conf", LOG_DEBUG);
echo " -> we change entity so we reload user and conf";
dol_syslog("cron_run_jobs.php we work on another entity so we reload mysoc, langs, user and conf", LOG_DEBUG);
echo " -> we change entity so we reload mysoc, langs, user and conf";
$conf->entity = (empty($line->entity)?1:$line->entity);
$conf->setValues($db); // This make also the $mc->setValues($conf); that reload $mc->sharings
$mysoc->setMysoc($conf);
// Force recheck that user is ok for the entity to process and reload permission for entity
if ($conf->entity != $user->entity && $user->entity != 0)
@@ -218,6 +219,11 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs)>0))
}
$user->getrights();
}
// Reload langs
$langcode = (empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT);
if (! empty($user->conf->MAIN_LANG_DEFAULT)) $langcode = $user->conf->MAIN_LANG_DEFAULT;
if ($langs->getDefaultLang() != $langcode) $langs->setDefaultLang($langcode);
}
//If date_next_jobs is less of current date, execute the program, and store the execution time of the next execution in database