2
0
forked from Wavyzz/dolibarr

Compare commits

...

35 Commits
12.0.0 ... 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
15 changed files with 295 additions and 230 deletions

View File

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

View File

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

View File

@@ -365,8 +365,8 @@ else
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{ {
$result = $db->query($sql); $resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result); $nbtotalofrecords = $db->num_rows($resql);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{ {
$page = 0; $page = 0;
@@ -376,18 +376,18 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$sql.= $db->plimit($limit+1, $offset); $sql.= $db->plimit($limit+1, $offset);
$result = $db->query($sql); $resql = $db->query($sql);
if (! $result) if (! $resql)
{ {
dol_print_error($db); dol_print_error($db);
exit; exit;
} }
$num = $db->num_rows($result); $num = $db->num_rows($resql);
$arrayofselected=is_array($toselect)?$toselect:array(); $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); $obj = $db->fetch_object($resql);
$id = $obj->rowid; $id = $obj->rowid;
@@ -715,7 +715,7 @@ $i = 0;
$totalarray=array(); $totalarray=array();
while ($i < min($num,$limit)) while ($i < min($num,$limit))
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($resql);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@@ -914,7 +914,7 @@ while ($i < min($num,$limit))
$i++; $i++;
} }
$db->free($result); $db->free($resql);
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook $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'); $handlein = popen($fullcommandclear, 'r');
$i=0; $i=0;
while (!feof($handlein)) if ($handlein) {
{ while (!feof($handlein))
$i++; // output line number {
$read = fgets($handlein); $i++; // output line number
// Exclude warning line we don't want $read = fgets($handlein);
if ($i == 1 && preg_match('/Warning.*Using a password/i', $read)) continue; // Exclude warning line we don't want
fwrite($handle, $read); if ($i == 1 && preg_match('/Warning.*Using a password/i', $read)) continue;
if (preg_match('/'.preg_quote('-- Dump completed').'/i', $read)) $ok=1; fwrite($handle, $read);
elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES').'/i', $read)) $ok=1; 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'; $classpath = 'fourn/class';
$module='fournisseur'; $module='fournisseur';
} }
elseif ($objecttype == 'supplier_proposal') {
$classfile = 'supplier_proposal';
$classname = 'SupplierProposal';
$classpath = 'supplier_proposal/class';
$module = 'supplier_proposal';
}
elseif ($objecttype == 'stock') { elseif ($objecttype == 'stock') {
$classpath = 'product/stock/class'; $classpath = 'product/stock/class';
$classfile='entrepot'; $classfile='entrepot';

View File

@@ -13,125 +13,142 @@
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
* or see http://www.gnu.org/ * 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 * \brief A set of functions for Dolibarr
* This file contains all frequently used functions. * 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 (must be a numeric value, like reported by price2num())
* @param float $num Number to convert * @param Translate $langs Language
* @param Lang $langs Language * @param boolean $currency 0=number to translate | 1=currency to translate
* @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
* @param boolean $centimes 0=no centimes | 1=centimes to translate * @return string|false Text of the number
* @return string Text of the number
*/ */
function dol_convertToWord($num, $langs, $currency=false, $centimes=false) function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
{ {
global $conf; global $conf;
$num = str_replace(array(',', ' '), '', trim($num)); //$num = str_replace(array(',', ' '), '', trim($num)); This should be useless since $num MUST be a php numeric value
if(! $num) { if (!$num) {
return false; 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;
} }
// If we need to write cents call again this function for cents if ($centimes && strlen($num) == 1) {
if(!empty($TNum[1])) { $num = $num * 10;
if(!empty($currency)) $concatWords .= ' '.$langs->transnoentities('and'); }
$concatWords .= ' '.dol_convertToWord($TNum[1], $langs, $currency, true);
if(!empty($currency)) $concatWords .= ' '.$langs->transnoentities('centimes'); 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. * Function to return number or amount in text.
* *
* @deprecated * @deprecated
* @param float $numero Number to convert * @param float $numero Number to convert
* @param Lang $langs Language * @param Translate $langs Language
* @param string $numorcurrency 'number' or 'amount' * @param string $numorcurrency 'number' or 'amount'
* @return string Text of the number or -1 in case TOO LONG (more than 1000000000000.99) * @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 the number is negative convert to positive and return -1 if is too long
if ($numero < 0) $numero *= -1; if ($numero < 0) $numero *= -1;
if ($numero >= 1000000000001) if ($numero >= 1000000000001)
return -1; return -1;
// Get 2 decimals to cents, another functions round or truncate // Get 2 decimals to cents, another functions round or truncate
$strnumber = number_format ($numero,10); $strnumber = number_format($numero, 10);
$len=strlen($strnumber); $len = strlen($strnumber);
for ($i=0; $i<$len; $i++) for ($i = 0; $i < $len; $i++)
{ {
if ($strnumber[$i]=='.') { if ($strnumber[$i] == '.') {
$parte_decimal = $strnumber[$i+1].$strnumber[$i+2]; $parte_decimal = $strnumber[$i + 1].$strnumber[$i + 2];
break; break;
}
} }
}
/*In dolibarr 3.6.2 (my current version) doesn't have $langs->default and /*In dolibarr 3.6.2 (my current version) doesn't have $langs->default and
in case exist why ask $lang like a parameter?*/ 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 (((is_object($langs) && $langs->default == 'es_MX') || (!is_object($langs) && $langs == 'es_MX')) && $numorcurrency == 'currency')
{ {
if ($numero>=1 && $numero<2) { if ($numero >= 1 && $numero < 2) {
return ("UN PESO ".$parte_decimal." / 100 M.N."); 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 ";
} }
if ($number >= 1000000){ elseif ($numero >= 0 && $numero < 1) {
$CdMILLON = (int) ($numero / 100000000); return ("CERO PESOS ".$parte_decimal." / 100 M.N.");
$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) { elseif ($numero >= 1000000 && $numero < 1000001) {
$cdm = (int) ($numero / 100000); return ("UN MILL&OacuteN DE PESOS ".$parte_decimal." / 100 M.N.");
$numero = $numero - $cdm * 100000; }
$ddm = (int) ($numero / 10000); elseif ($numero >= 1000000000000 && $numero < 1000000000001) {
$numero = $numero - $ddm * 10000; return ("UN BILL&OacuteN DE PESOS ".$parte_decimal." / 100 M.N.");
$udm = (int) ($numero / 1000); }
$numero = $numero - $udm * 1000; else {
$entexto .= hundreds2text ($cdm, $ddm, $udm); $entexto = "";
if ($cdm || $ddm || $udm) $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 "; $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); return $entexto;
$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;
}
} }
/** /**
@@ -237,40 +254,40 @@ function dolNumberToWord($numero, $langs, $numorcurrency='number')
*/ */
function hundreds2text($hundreds, $tens, $units) function hundreds2text($hundreds, $tens, $units)
{ {
if ($hundreds==1 && $tens==0 && $units==0){ if ($hundreds == 1 && $tens == 0 && $units == 0) {
return "CIEN"; return "CIEN";
} }
$centenas = array("CIENTO","DOSCIENTOS","TRESCIENTOS","CUATROCIENTOS","QUINIENTOS","SEISCIENTOS","SETECIENTOS","OCHOCIENTOS","NOVECIENTOS"); $centenas = array("CIENTO", "DOSCIENTOS", "TRESCIENTOS", "CUATROCIENTOS", "QUINIENTOS", "SEISCIENTOS", "SETECIENTOS", "OCHOCIENTOS", "NOVECIENTOS");
$decenas = array("","","TREINTA ","CUARENTA ","CINCUENTA ","SESENTA ","SETENTA ","OCHENTA ","NOVENTA "); $decenas = array("", "", "TREINTA ", "CUARENTA ", "CINCUENTA ", "SESENTA ", "SETENTA ", "OCHENTA ", "NOVENTA ");
$veintis = array("VEINTE","VEINTIUN","VEINTID&OacuteS","VEINTITR&EacuteS","VEINTICUATRO","VEINTICINCO","VEINTIS&EacuteIS","VEINTISIETE","VEINTIOCHO","VEINTINUEVE"); $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"); $diecis = array("DIEZ", "ONCE", "DOCE", "TRECE", "CATORCE", "QUINCE", "DIECIS&EacuteIS", "DIECISIETE", "DIECIOCHO", "DIECINUEVE");
$unidades = array("UN","DOS","TRES","CUATRO","CINCO","SEIS","SIETE","OCHO","NUEVE"); $unidades = array("UN", "DOS", "TRES", "CUATRO", "CINCO", "SEIS", "SIETE", "OCHO", "NUEVE");
$entexto = ""; $entexto = "";
if ($hundreds!=0){ if ($hundreds != 0) {
$entexto .= $centenas[$hundreds-1]; $entexto .= $centenas[$hundreds - 1];
} }
if ($tens>2){ if ($tens > 2) {
if ($hundreds!=0) $entexto .= " "; if ($hundreds != 0) $entexto .= " ";
$entexto .= $decenas[$tens-1]; $entexto .= $decenas[$tens - 1];
if ($units!=0){ if ($units != 0) {
$entexto .= " Y "; $entexto .= " Y ";
$entexto .= $unidades[$units-1]; $entexto .= $unidades[$units - 1];
} }
return $entexto; return $entexto;
} }
elseif ($tens==2){ elseif ($tens == 2) {
if ($hundreds!=0) $entexto .= " "; if ($hundreds != 0) $entexto .= " ";
$entexto .= " ".$veintis[$units]; $entexto .= " ".$veintis[$units];
return $entexto; return $entexto;
} }
elseif ($tens==1){ elseif ($tens == 1) {
if ($hundreds!=0) $entexto .= " "; if ($hundreds != 0) $entexto .= " ";
$entexto .= $diecis[$units]; $entexto .= $diecis[$units];
return $entexto; return $entexto;
} }
if ($units!=0) { if ($units != 0) {
if ($hundreds!=0 || $tens!=0) $entexto .= " "; if ($hundreds != 0 || $tens != 0) $entexto .= " ";
$entexto .= $unidades[$units-1]; $entexto .= $unidades[$units - 1];
} }
return $entexto; return $entexto;
} }

View File

@@ -1826,7 +1826,6 @@ function pdf_getlineunit($object, $i, $outputlangs, $hidedetails = 0, $hookmanag
} }
if (empty($reshook)) if (empty($reshook))
{ {
if ($object->lines[$i]->special_code == 3) return '';
if (empty($hidedetails) || $hidedetails > 1) $result.=$langs->transnoentitiesnoconv($object->lines[$i]->getLabelOfUnit('short')); if (empty($hidedetails) || $hidedetails > 1) $result.=$langs->transnoentitiesnoconv($object->lines[$i]->getLabelOfUnit('short'));
} }
return $result; return $result;
@@ -2072,7 +2071,7 @@ function pdf_getTotalQty($object,$type,$outputlangs)
*/ */
function pdf_getLinkedObjects($object,$outputlangs) function pdf_getLinkedObjects($object,$outputlangs)
{ {
global $hookmanager; global $db, $hookmanager;
$linkedobjects=array(); $linkedobjects=array();
@@ -2128,8 +2127,13 @@ function pdf_getLinkedObjects($object,$outputlangs)
// We concat this record info into fields xxx_value. title is overwrote. // 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 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(); $elementobject->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0);
if (! empty($elementobject->linkedObjects['commande'])) $order = reset($elementobject->linkedObjects['commande']); 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)) if (! is_object($order))
{ {

View File

@@ -1251,9 +1251,17 @@ class pdf_einstein extends ModelePDFCommandes
// Logo // Logo
if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
{ {
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
if ($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)) if (is_readable($logo))
{ {
$height=pdf_getHeightForLogo($logo); $height=pdf_getHeightForLogo($logo);

View File

@@ -1563,9 +1563,17 @@ class pdf_crabe extends ModelePDFFactures
// Logo // Logo
if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
{ {
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
if ($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)) if (is_readable($logo))
{ {
$height=pdf_getHeightForLogo($logo); $height=pdf_getHeightForLogo($logo);

View File

@@ -1453,9 +1453,17 @@ class pdf_azur extends ModelePDFPropales
// Logo // Logo
if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
{ {
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
if ($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)) if (is_readable($logo))
{ {
$height=pdf_getHeightForLogo($logo); $height=pdf_getHeightForLogo($logo);

View File

@@ -1449,9 +1449,17 @@ class pdf_cyan extends ModelePDFPropales
// Logo // Logo
if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
{ {
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
if ($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)) if (is_readable($logo))
{ {
$height=pdf_getHeightForLogo($logo); $height=pdf_getHeightForLogo($logo);

View File

@@ -766,7 +766,9 @@ class pdf_standard extends ModelePDFSuppliersPayments
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs); $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 // Show recipient
$widthrecbox=90; $widthrecbox=90;

View File

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

View File

@@ -2146,7 +2146,7 @@ class ExpenseReport extends CommonObject
$sql = "SELECT DISTINCT ur.fk_user"; $sql = "SELECT DISTINCT ur.fk_user";
$sql.= " FROM ".MAIN_DB_PREFIX."user_rights as ur, ".MAIN_DB_PREFIX."rights_def as rd"; $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.= " 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.= " 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.= " 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'; $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 '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
require DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
$langs->loadLangs(array('bills', 'banks', 'companies', 'suppliers')); $langs->loadLangs(array('bills', 'banks', 'companies', 'suppliers'));
@@ -210,7 +210,7 @@ if ($result > 0)
*/ */
// Amount // 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)) if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
{ {