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

This commit is contained in:
ldestailleur 2025-03-24 18:23:46 +01:00
commit 2dc191afe2
30 changed files with 216 additions and 41 deletions

View file

@ -1,8 +1,9 @@
<?php
/*
* Copyright (C) 2016 Xebax Christy <xebax@wanadoo.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2016 Xebax Christy <xebax@wanadoo.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 Charlene Benke <charlene@patas-monkey.com>
*
* 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
@ -113,6 +114,7 @@ class BankAccounts extends DolibarrApi
$obj = $this->db->fetch_object($result);
$account = new Account($this->db);
if ($account->fetch($obj->rowid) > 0) {
$account->balance = $account->solde(1); // 1=Exclude future operation date
$list[] = $this->_filterObjectProperties($this->_cleanObjectDatas($account), $properties);
}
}

View file

@ -380,12 +380,19 @@ class doc_generic_asset_odt extends ModelePDFAsset
$parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
$ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
} else {
$ratio = 1;
}
foreach ($tmparray as $key => $value) {
try {
if (preg_match('/logo$/', $key)) {
// Image
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}

View file

@ -378,11 +378,18 @@ class doc_generic_bom_odt extends ModelePDFBom
$parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
$ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
} else {
$ratio = 1;
}
foreach ($tmparray as $key => $value) {
try {
if (preg_match('/logo$/', $key)) { // Image
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}

View file

@ -399,11 +399,18 @@ class doc_generic_order_odt extends ModelePDFCommandes
$parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
$ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
} else {
$ratio = 1;
}
foreach ($tmparray as $key => $value) {
try {
if (preg_match('/logo$/', $key)) { // Image
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}

View file

@ -389,13 +389,19 @@ class doc_generic_contract_odt extends ModelePDFContract
// Call the ODTSubstitution hook
$parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
$ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
} else {
$ratio = 1;
}
foreach ($tmparray as $key => $value) {
try {
if (preg_match('/logo$/', $key)) {
// Image
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}

View file

@ -372,6 +372,13 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
dol_syslog($e->getMessage(), LOG_INFO);
}
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
$ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
} else {
$ratio = 1;
}
// Make substitutions into odt of user info
$tmparray = $this->get_substitutionarray_user($user, $outputlangs);
foreach ($tmparray as $key => $value) {
@ -379,7 +386,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
if (preg_match('/logo$/', $key)) { // Image
//var_dump($value);exit;
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}
@ -397,7 +404,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
if (preg_match('/logo$/', $key)) { // Image
//var_dump($value);exit;
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}
@ -419,7 +426,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
try {
if (preg_match('/logo$/', $key)) { // Image
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}
@ -437,7 +444,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
try {
if (preg_match('/logo$/', $key)) { // Image
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}
@ -464,7 +471,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
if (preg_match('/logo$/', $key)) {
// Image
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}

View file

@ -453,12 +453,20 @@ class doc_generic_invoice_odt extends ModelePDFFactures
$parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
$ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
} else {
$ratio = 1;
}
//var_dump($tmparray); exit;
foreach ($tmparray as $key => $value) {
try {
if (preg_match('/logo$/', $key)) { // Image
//var_dump($value);exit;
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}

View file

@ -298,7 +298,7 @@ class mailing_partnership extends MailingTargets
return '<a href="'.DOL_URL_ROOT.'/societe/card.php?socid='.((int) $id).'">'.img_object('', "societe").'</a>';
}
if ($sourcetype == 'member') {
return '<a href="'.DOL_URL_ROOT.'/adherent/card.php?id='.((int) $id).'">'.img_object('', "member").'</a>';
return '<a href="'.DOL_URL_ROOT.'/adherents/card.php?id='.((int) $id).'">'.img_object('', "member").'</a>';
}
return '';

View file

@ -351,12 +351,20 @@ class doc_generic_member_odt extends ModelePDFMember
'substitutionarray' => &$tmparray
);
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
$ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
} else {
$ratio = 1;
}
foreach ($tmparray as $key => $value) {
try {
if (preg_match('/logo$/', $key)) {
// Image
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}

View file

@ -378,12 +378,19 @@ class doc_generic_mo_odt extends ModelePDFMo
$parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
$ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
} else {
$ratio = 1;
}
foreach ($tmparray as $key => $value) {
try {
if (preg_match('/logo$/', $key)) {
// Image
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}

View file

@ -390,11 +390,18 @@ class doc_generic_product_odt extends ModelePDFProduct
$parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
$ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
} else {
$ratio = 1;
}
foreach ($tmparray as $key => $value) {
try {
if (preg_match('/logo$/', $key)) { // Image
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}

View file

@ -651,11 +651,18 @@ class doc_generic_project_odt extends ModelePDFProjects
$parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
$ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
} else {
$ratio = 1;
}
foreach ($tmparray as $key => $value) {
try {
if (preg_match('/logo$/', $key)) { // Image
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}

View file

@ -590,11 +590,18 @@ class doc_generic_task_odt extends ModelePDFTask
$tmparray = array_merge($substitutionarray, $array_object_from_properties, $array_user, $array_soc, $array_thirdparty, $array_objet, $array_other);
complete_substitutions_array($tmparray, $outputlangs, $object);
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
$ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
} else {
$ratio = 1;
}
foreach ($tmparray as $key => $value) {
try {
if (preg_match('/logo$/', $key)) { // Image
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}

View file

@ -436,11 +436,18 @@ class doc_generic_proposal_odt extends ModelePDFPropales
$parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
$ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
} else {
$ratio = 1;
}
foreach ($tmparray as $key => $value) {
try {
if (preg_match('/logo$/', $key)) { // Image
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}

View file

@ -385,11 +385,19 @@ class doc_generic_reception_odt extends ModelePdfReception
// Call the ODTSubstitution hook
$parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
$ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
} else {
$ratio = 1;
}
foreach ($tmparray as $key => $value) {
try {
if (preg_match('/logo$/', $key)) { // Image
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}

View file

@ -384,12 +384,19 @@ class doc_generic_odt extends ModeleThirdPartyDoc
$parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
$ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
} else {
$ratio = 1;
}
// Replace variables into document
foreach ($tmparray as $key => $value) {
try {
if (preg_match('/logo$/', $key)) { // Image
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}

View file

@ -388,11 +388,18 @@ class doc_generic_stock_odt extends ModelePDFStock
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
$ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
} else {
$ratio = 1;
}
foreach ($tmparray as $key => $value) {
try {
if (preg_match('/logo$/', $key)) { // Image
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}

View file

@ -390,11 +390,18 @@ class doc_generic_supplier_invoice_odt extends ModelePDFSuppliersInvoices
$parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
$ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
} else {
$ratio = 1;
}
foreach ($tmparray as $key => $value) {
try {
if (preg_match('/logo$/', $key)) { // Image
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}

View file

@ -385,11 +385,18 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders
$parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
$ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
} else {
$ratio = 1;
}
foreach ($tmparray as $key => $value) {
try {
if (preg_match('/logo$/', $key)) { // Image
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}

View file

@ -414,11 +414,18 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
$parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
$ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
} else {
$ratio = 1;
}
foreach ($tmparray as $key => $value) {
try {
if (preg_match('/logo$/', $key)) { // Image
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}

View file

@ -346,11 +346,19 @@ class doc_generic_ticket_odt extends ModelePDFTicket
// Call the ODTSubstitution hook
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
$ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
} else {
$ratio = 1;
}
foreach ($tmparray as $key => $value) {
try {
if (preg_match('/logo$/', $key)) { // Image
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}

View file

@ -377,11 +377,19 @@ class doc_generic_user_odt extends ModelePDFUser
// Call the ODTSubstitution hook
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
$ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
} else {
$ratio = 1;
}
foreach ($tmparray as $key => $value) {
try {
if (preg_match('/logo$/', $key)) { // Image
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}

View file

@ -412,11 +412,19 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
// Call the ODTSubstitution hook
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
$ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
} else {
$ratio = 1;
}
foreach ($tmparray as $key => $value) {
try {
if (preg_match('/logo$/', $key)) { // Image
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}

View file

@ -204,7 +204,7 @@ if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currenc
}
if ($outputalsopricetotalwithtax) {
print '<th class="right" style="width: 80px">'.$langs->trans('TotalTTCShort').'</th>';
print '<th class="linecolttc right" style="width: 80px">'.$langs->trans('TotalTTCShort').'</th>';
}
if (isModEnabled('asset') && $object->element == 'invoice_supplier') {

View file

@ -517,7 +517,7 @@ if ($line->special_code == 3) {
// Price inc tax
if ($outputalsopricetotalwithtax) {
print '<td class="linecolht nowrap right">'.price($sign * $line->total_ttc).'</td>';
print '<td class="linecolttc nowrap right">'.price($sign * $line->total_ttc).'</td>';
$coldisplay++;
}

View file

@ -257,10 +257,11 @@ class Segment implements IteratorAggregate, Countable
*
* @param string $key name of the variable within the template
* @param string $value path to the picture
* @param float $ratio Ratio for image
* @throws OdfException
* @return Segment
*/
public function setImage($key, $value)
public function setImage($key, $value, float $ratio=1)
{
$filename = strtok(strrchr($value, '/'), '/.');
$file = substr(strrchr($value, '/'), 1);
@ -270,8 +271,8 @@ class Segment implements IteratorAggregate, Countable
}
// Set the width and height of the page
list ($width, $height) = $size;
$width *= Odf::PIXEL_TO_CM;
$height *= Odf::PIXEL_TO_CM;
$width *= Odf::PIXEL_TO_CM * $ratio;
$height *= Odf::PIXEL_TO_CM * $ratio;
// Fix local-aware issues (eg: 12,10 -> 12.10)
$width = sprintf("%F", $width);
$height = sprintf("%F", $height);

View file

@ -529,10 +529,11 @@ class Odf
*
* @param string $key name of the variable within the template
* @param string $value path to the picture
* @param float $ratio Ratio for image
* @throws OdfException
* @return odf
*/
public function setImage($key, $value)
public function setImage($key, $value, float $ratio=1)
{
$filename = strtok(strrchr($value, '/'), '/.');
$file = substr(strrchr($value, '/'), 1);
@ -541,8 +542,8 @@ class Odf
throw new OdfException("Invalid image");
}
list ($width, $height) = $size;
$width *= self::PIXEL_TO_CM;
$height *= self::PIXEL_TO_CM;
$width *= self::PIXEL_TO_CM * $ratio;
$height *= self::PIXEL_TO_CM * $ratio;
$xml = <<<IMG
<draw:frame draw:style-name="fr1" draw:name="$filename" text:anchor-type="aschar" svg:width="{$width}cm" svg:height="{$height}cm" draw:z-index="3"><draw:image xlink:href="Pictures/$file" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/></draw:frame>
IMG;

View file

@ -415,12 +415,19 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
$parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
$ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
} else {
$ratio = 1;
}
foreach ($tmparray as $key => $value) {
try {
if (preg_match('/logo$/', $key)) {
// Image
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}

View file

@ -376,8 +376,13 @@ if ($id > 0 || !empty($ref)) {
$atleastonenotdefined = 0; // at least on buying price not defined
$tmpurlforbutton = 'javascript:console.log("click to add a product in kit");jQuery(".formtoaddinkit").toggle();';
$morehtmlright = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $tmpurlforbutton, '', $usercancreate ? 1 : 0);
$tmpurlforbutton = 'javascript:void(0);';
$newButtonParams = [
'attr' => [
'onclick' => 'console.log("click to add a product in kit");jQuery(".formtoaddinkit").toggle();return false;',
]
];
$morehtmlright = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $tmpurlforbutton, '', $usercancreate ? 1 : 0, $newButtonParams);
print load_fiche_titre($langs->trans("ProductAssociationList"), $morehtmlright, '');

View file

@ -408,12 +408,19 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi
$parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
$ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
} else {
$ratio = 1;
}
foreach ($tmparray as $key => $value) {
try {
if (preg_match('/logo$/', $key)) {
// Image
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}