From 3b72cade4ed2fb9bbb529ed3aaf6b072f1659eea Mon Sep 17 00:00:00 2001 From: John Botella Date: Mon, 2 Dec 2019 17:32:06 +0100 Subject: [PATCH 01/33] Fix exif image with conf MAIN_USE_EXIF_ROTATION --- htdocs/core/lib/images.lib.php | 166 +++++++++++++++++++++++++++------ htdocs/document.php | 14 ++- 2 files changed, 152 insertions(+), 28 deletions(-) diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 2f7406bbaf9..bd0e9b5da79 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -306,35 +306,94 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, */ function dolRotateImage($file_path) { - $exif = @exif_read_data($file_path); - if ($exif === false) { - return false; - } - $orientation = intval(@$exif['Orientation']); - if (!in_array($orientation, array(3, 6, 8))) { - return false; - } - $image = @imagecreatefromjpeg($file_path); - switch ($orientation) { - case 3: - $image = @imagerotate($image, 180, 0); - break; - case 6: - $image = @imagerotate($image, 270, 0); - break; - case 8: - $image = @imagerotate($image, 90, 0); - break; - default: - return false; - } - $success = imagejpeg($image, $file_path); - // Free up memory (imagedestroy does not delete files): - @imagedestroy($image); - return $success; + return correctExifImageOrientation($file_path, $file_path); } +/** + * Add exif orientation correction for image + * + * @param $fileSource string + * @param $fileDest string | false | null : on false return gd img on null , on NULL the raw image stream will be outputted directly + * @param $quality int + * @return bool true on success or false on failure or gd img if $fileDest is false. + */ +function correctExifImageOrientation($fileSource, $fileDest, $quality = 95) +{ + if (function_exists('exif_read_data') ) { + $exif = exif_read_data($fileSource); + if($exif && isset($exif['Orientation'])) { + + $infoImg = getimagesize($fileSource); // Get image infos + + $orientation = $exif['Orientation']; + if($orientation != 1){ + $img = imagecreatefromjpeg($fileSource); + $deg = 0; + switch ($orientation) { + case 3: + $deg = 180; + break; + case 6: + $deg = 270; + break; + case 8: + $deg = 90; + break; + } + if ($deg) { + if($infoImg[2] === 'IMAGETYPE_PNG') // In fact there is no exif on PNG but just in case + { + imagealphablending($img, false); + imagesavealpha($img, true); + $img = imagerotate($img, $deg, imageColorAllocateAlpha($img, 0, 0, 0, 127)); + imagealphablending($img, false); + imagesavealpha($img, true); + } + else{ + $img = imagerotate($img, $deg, 0); + } + } + // then rewrite the rotated image back to the disk as $fileDest + if($fileDest === false){ + return $img; + } + else + { + // In fact there exif is only for JPG but just in case + // Create image on disk + $image = false; + + switch($infoImg[2]) + { + case IMAGETYPE_GIF: // 1 + $image = imagegif($img, $fileDest); + break; + case IMAGETYPE_JPEG: // 2 + return imagejpeg($img, $fileDest, $quality); + break; + case IMAGETYPE_PNG: // 3 + $image = imagepng($img, $fileDest, $quality); + break; + case IMAGETYPE_BMP: // 6 + // Not supported by PHP GD + break; + case IMAGETYPE_WBMP: // 15 + $image = image2wbmp($img, $fileDest); + break; + } + + // Free up memory (imagedestroy does not delete files): + @imagedestroy($img); + + return $image; + } + } // if there is some rotation necessary + } // if have the exif orientation info + } // if function exists + + return false; +} /** * Create a thumbnail from an image file (Supported extensions are gif, jpg, png and bmp). @@ -394,6 +453,13 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', $imgWidth = $infoImg[0]; // Largeur de l'image $imgHeight = $infoImg[1]; // Hauteur de l'image + $exif = exif_read_data($filetoread); + $ort= false; + if($exif && !empty($exif['Orientation'])){ + $ort = $exif['Orientation']; + } + + if ($maxWidth == -1) $maxWidth=$infoImg[0]; // If size is -1, we keep unchanged if ($maxHeight == -1) $maxHeight=$infoImg[1]; // If size is -1, we keep unchanged @@ -467,6 +533,54 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', dol_syslog('Failed to detect type of image. We found infoImg[2]='.$infoImg[2], LOG_WARNING); return 0; } + $exifAngle = false; + if($ort && !empty($conf->global->MAIN_USE_EXIF_ROTATION)){ + + switch($ort) + { + case 3: // 180 rotate left + $exifAngle = 180; + break; + case 6: // 90 rotate right + $exifAngle = -90; + // changing sizes + $trueImgWidth = $infoImg[1]; + $trueImgHeight = $infoImg[0]; + break; + case 8: // 90 rotate left + $exifAngle = 90; + // changing sizes + $trueImgWidth = $infoImg[1]; // Largeur de l'image + $trueImgHeight = $infoImg[0]; // Hauteur de l'image + break; + } + } + + if($exifAngle) + { + $rotated = false; + + if($infoImg[2] === 'IMAGETYPE_PNG') // In fact there is no exif on PNG but just in case + { + imagealphablending($img, false); + imagesavealpha($img, true); + $rotated = imagerotate($img, $exifAngle, imageColorAllocateAlpha($img, 0, 0, 0, 127)); + imagealphablending($rotated, false); + imagesavealpha($rotated, true); + } + else{ + $rotated = imagerotate($img, $exifAngle, 0); + } + + // replace image with good orientation + if(!empty($rotated)){ + $img = $rotated; + $imgWidth = $trueImgWidth; + $imgHeight = $trueImgHeight; + } + } + + // Initialisation des dimensions de la vignette si elles sont superieures a l'original if($maxWidth > $imgWidth){ $maxWidth = $imgWidth; } diff --git a/htdocs/document.php b/htdocs/document.php index 2b37792d69a..991b0f3e861 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -71,6 +71,7 @@ function llxFooter() require 'main.inc.php'; // Load $user and permissions require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; $encoding = ''; $action=GETPOST('action', 'alpha'); @@ -250,11 +251,20 @@ if ($encoding) header('Content-Encoding: '.$encoding); // Add MIME Content-Disposition from RFC 2183 (inline=automatically displayed, attachment=need user action to open) if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); else header('Content-Disposition: inline; filename="'.$filename.'"'); -header('Content-Length: ' . dol_filesize($fullpath_original_file)); // Ajout directives pour resoudre bug IE header('Cache-Control: Public, must-revalidate'); header('Pragma: public'); +$readfile = true; -readfile($fullpath_original_file_osencoded); +// on view document, can output images with good orientation according to exif infos +if (!$attachment && !empty($conf->global->MAIN_USE_EXIF_ROTATION) && image_format_supported($fullpath_original_file_osencoded) == 1) { + $imgres = correctExifImageOrientation($fullpath_original_file_osencoded, null); + $readfile = !$imgres; +} + +if($readfile){ + header('Content-Length: ' . dol_filesize($fullpath_original_file)); + readfile($fullpath_original_file_osencoded); +} if (is_object($db)) $db->close(); From 2b01576aa96e1995025ee4cbde2454b583909c2a Mon Sep 17 00:00:00 2001 From: John Botella Date: Tue, 3 Dec 2019 09:24:11 +0100 Subject: [PATCH 02/33] Fix comment --- htdocs/core/lib/images.lib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index bd0e9b5da79..37627a15bf9 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -313,10 +313,10 @@ function dolRotateImage($file_path) /** * Add exif orientation correction for image * - * @param $fileSource string - * @param $fileDest string | false | null : on false return gd img on null , on NULL the raw image stream will be outputted directly - * @param $quality int - * @return bool true on success or false on failure or gd img if $fileDest is false. + * @param string $fileSource Full path to source image to rotate + * @param string $fileDest string : Full path to image to rotate | false return gd img | null the raw image stream will be outputted directly + * @param int $quality + * @return bool : true on success or false on failure or gd img if $fileDest is false. */ function correctExifImageOrientation($fileSource, $fileDest, $quality = 95) { From f806c0da78e8caef3aabd5f1346aca60b84e6df3 Mon Sep 17 00:00:00 2001 From: John Botella Date: Tue, 3 Dec 2019 09:29:04 +0100 Subject: [PATCH 03/33] Fix comment missing --- htdocs/core/lib/images.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 37627a15bf9..6204dd0dd9f 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -315,7 +315,7 @@ function dolRotateImage($file_path) * * @param string $fileSource Full path to source image to rotate * @param string $fileDest string : Full path to image to rotate | false return gd img | null the raw image stream will be outputted directly - * @param int $quality + * @param int $quality output image quality * @return bool : true on success or false on failure or gd img if $fileDest is false. */ function correctExifImageOrientation($fileSource, $fileDest, $quality = 95) From 78acf07e4c1ad74a321e49911c10b118e0737691 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Dec 2019 14:59:05 +0100 Subject: [PATCH 04/33] Fix bad side effect of debugbar with android --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 5fbc453583b..63b8eaa5561 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -253,7 +253,7 @@ require_once 'master.inc.php'; register_shutdown_function('dol_shutdown'); // Load debugbar -if (! empty($conf->debugbar->enabled)) +if (!empty($conf->debugbar->enabled) && ! GETPOST('dol_use_jmobile') && empty($_SESSION['dol_use_jmobile'])) { global $debugbar; include_once DOL_DOCUMENT_ROOT.'/debugbar/class/DebugBar.php'; From d153918a10907328ee09c5f34e7c093ce810623a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Dec 2019 15:00:52 +0100 Subject: [PATCH 05/33] Fix trans --- htdocs/comm/action/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 2ef4c74f765..dc00a4dd091 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -37,7 +37,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; // Load translation files required by the page -$langs->loadLangs(array("users","companies","agenda","commercial")); +$langs->loadLangs(array("users","companies","agenda","commercial","other")); $action=GETPOST('action', 'alpha'); $contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'actioncommlist'; // To manage different context of search From 474057de1f083358fe813c205a5aed11a6bd493f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Dec 2019 15:12:18 +0100 Subject: [PATCH 06/33] Fix reponsive --- htdocs/theme/eldy/global.inc.php | 7 +++++-- htdocs/theme/md/style.css.php | 10 +++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index e076d6eb58a..975edc2787f 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -529,8 +529,8 @@ body[class*="colorblind-"] .text-success{ .fa-toggle-on, .fa-toggle-off { font-size: 2em; } .websiteselectionsection .fa-toggle-on, .websiteselectionsection .fa-toggle-off, -.asetresetmodule .fa-toggle-on, .asetresetmodule .fa-toggle-off { - font-size: 1.5em; vertical-align: text-bottom; +.asetresetmodule .fa-toggle-on, .asetresetmodule .fa-toggle-off { + font-size: 1.5em; vertical-align: text-bottom; } /* Themes for badges */ @@ -5958,6 +5958,9 @@ div.tabsElem a.tab { line-height: unset; } + .btnTitle-label { + display: none; + } } - -close(); From 85d8d2ff586d36855f0afa8ef440c30c397d991e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 3 Dec 2019 15:19:58 +0100 Subject: [PATCH 07/33] select_product_fourn_price returns void --- htdocs/product/stock/replenish.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 335881f7993..640a6eaa32e 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -723,7 +723,9 @@ while ($i < ($limit ? min($num, $limit) : $num)) print ''; // Supplier - print ''.$form->select_product_fourn_price($prod->id, 'fourn'.$i, $fk_supplier).''; + print ''; + $form->select_product_fourn_price($prod->id, 'fourn'.$i, $fk_supplier); + print ''; // Fields from hook $parameters = array('objp'=>$objp); From 2c86aab9ca3a3164a09c16047587e1634e1a0399 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Dec 2019 15:22:46 +0100 Subject: [PATCH 08/33] Fix responsive --- htdocs/societe/list.php | 2 +- htdocs/theme/eldy/global.inc.php | 1 + htdocs/theme/md/style.css.php | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 504ccb37a25..ba01b901f9f 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -949,7 +949,7 @@ if (!empty($arrayfields['s.import_key']['checked'])) print ''; } // Action column -print ''; +print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; print ''; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 975edc2787f..73b0da9323c 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -372,6 +372,7 @@ th .button { } .maxwidthsearch { /* Max width of column with the search picto */ width: 54px; + min-width: 54px; } .valigntop { vertical-align: top; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 9557080020d..d450c939a49 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -594,6 +594,7 @@ th .button { } .maxwidthsearch { /* Max width of column with the search picto */ width: 54px; + min-width: 54px; } .valigntop { From 650c9c2e572be3c6834181ab78590f319274ced1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 3 Dec 2019 16:46:50 +0100 Subject: [PATCH 09/33] Update product.class.php --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 40360c9bbd0..88a0fc30488 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1201,7 +1201,7 @@ class Product extends CommonObject } //We also check if it is a child product - if (!$error && ($prodcomb->fetchByFkProductChild($id) > 0) && ($prodcomb->delete($user) < 0)) { + if (!$error && ($prodcomb->fetchByFkProductChild($this->id) > 0) && ($prodcomb->delete($user) < 0)) { $error++; $this->errors[] = 'Error deleting child combination'; } From e46f654e9fc653818d6f89d8956f846f4a066694 Mon Sep 17 00:00:00 2001 From: John Botella Date: Tue, 3 Dec 2019 17:27:13 +0100 Subject: [PATCH 10/33] Fix deprecated image2wbmp function --- htdocs/core/lib/images.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 6204dd0dd9f..55a39a492c7 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -279,7 +279,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, imagepng($imgThumb, $imgThumbName, $newquality); break; case 4: // Bmp - image2wbmp($imgThumb, $imgThumbName); + imagewbmp($imgThumb, $imgThumbName); break; } @@ -379,7 +379,7 @@ function correctExifImageOrientation($fileSource, $fileDest, $quality = 95) // Not supported by PHP GD break; case IMAGETYPE_WBMP: // 15 - $image = image2wbmp($img, $fileDest); + $image = imagewbmp($img, $fileDest); break; } @@ -696,7 +696,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', // Not supported by PHP GD break; case IMAGETYPE_WBMP: // 15 - image2wbmp($imgThumb, $imgThumbName); + imagewbmp($imgThumb, $imgThumbName); break; } From 5a17289e7579140d70e53b7e2a1fe0448be1df37 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Dec 2019 18:04:58 +0100 Subject: [PATCH 11/33] Fix crop for proposal image --- htdocs/core/class/html.formfile.class.php | 2 +- htdocs/core/photos_resize.php | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 3b2a7fcb872..0352700d91a 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1099,7 +1099,7 @@ class FormFile if ($disablecrop == -1) { $disablecrop = 1; - if (in_array($modulepart, array('bank', 'bom', 'expensereport', 'holiday', 'member', 'mrp', 'project', 'product', 'produit', 'service', 'societe', 'tax', 'ticket', 'user'))) $disablecrop = 0; + if (in_array($modulepart, array('bank', 'bom', 'expensereport', 'holiday', 'member', 'mrp', 'project', 'product', 'produit', 'propal', 'service', 'societe', 'tax', 'ticket', 'user'))) $disablecrop = 0; } // Define relative path used to store the file diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index eeff5007c55..cb57c81833d 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -119,9 +119,20 @@ elseif ($modulepart == 'project') { $result = $object->fetch($id); if ($result <= 0) dol_print_error($db, 'Failed to load object'); - $dir = $conf->projet->dir_output; // By default + $dir = $conf->project->multidir_output[$object->entity]; // By default } } +elseif ($modulepart == 'propal') +{ + require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; + $object = new Propal($db); + if ($id > 0) + { + $result = $object->fetch($id); + if ($result <= 0) dol_print_error($db, 'Failed to load object'); + $dir = $conf->propal->multidir_output[$object->entity]; // By default + } +} elseif ($modulepart == 'holiday') { require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; @@ -243,6 +254,7 @@ if (empty($backtourl)) elseif (in_array($modulepart, array('holiday'))) $backtourl = DOL_URL_ROOT."/holiday/document.php?id=".$id.'&file='.urldecode($_POST["file"]); elseif (in_array($modulepart, array('member'))) $backtourl = DOL_URL_ROOT."/adherents/document.php?id=".$id.'&file='.urldecode($_POST["file"]); elseif (in_array($modulepart, array('project'))) $backtourl = DOL_URL_ROOT."/projet/document.php?id=".$id.'&file='.urldecode($_POST["file"]); + elseif (in_array($modulepart, array('propal'))) $backtourl = DOL_URL_ROOT."/comm/propal/document.php?id=".$id.'&file='.urldecode($_POST["file"]); elseif (in_array($modulepart, array('societe'))) $backtourl = DOL_URL_ROOT."/societe/document.php?id=".$id.'&file='.urldecode($_POST["file"]); elseif (in_array($modulepart, array('tax'))) $backtourl = DOL_URL_ROOT."/compta/sociales/document.php?id=".$id.'&file='.urldecode($_POST["file"]); elseif (in_array($modulepart, array('ticket'))) $backtourl = DOL_URL_ROOT."/ticket/document.php?id=".$id.'&file='.urldecode($_POST["file"]); From 0ce1e5c007d84e8931359c54ee8864a387cdba20 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 3 Dec 2019 19:39:32 +0100 Subject: [PATCH 12/33] Fix : Fatal error: Uncaught Error: Class Facture not found --- htdocs/core/lib/pdf.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index fea8e204aeb..c2705fdc556 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1231,7 +1231,8 @@ function pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $pos function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0) { global $db, $conf, $langs; - + include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + $idprod = (!empty($object->lines[$i]->fk_product) ? $object->lines[$i]->fk_product : false); $label = (!empty($object->lines[$i]->label) ? $object->lines[$i]->label : (!empty($object->lines[$i]->product_label) ? $object->lines[$i]->product_label : '')); $desc = (!empty($object->lines[$i]->desc) ? $object->lines[$i]->desc : (!empty($object->lines[$i]->description) ? $object->lines[$i]->description : '')); From 24b5b9bd7295211cfe1130e8c2da997a8f4ce4ac Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 3 Dec 2019 18:42:29 +0000 Subject: [PATCH 13/33] Fixing style errors. --- htdocs/core/lib/pdf.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index c2705fdc556..edaac53a167 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1232,7 +1232,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, { global $db, $conf, $langs; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; - + $idprod = (!empty($object->lines[$i]->fk_product) ? $object->lines[$i]->fk_product : false); $label = (!empty($object->lines[$i]->label) ? $object->lines[$i]->label : (!empty($object->lines[$i]->product_label) ? $object->lines[$i]->product_label : '')); $desc = (!empty($object->lines[$i]->desc) ? $object->lines[$i]->desc : (!empty($object->lines[$i]->description) ? $object->lines[$i]->description : '')); From 22b17190e8896b309f2d3774121bcae99ecd0a53 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Dec 2019 22:26:33 +0100 Subject: [PATCH 14/33] Update pdf.lib.php --- htdocs/core/lib/pdf.lib.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index edaac53a167..0749d0a7645 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1231,7 +1231,6 @@ function pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $pos function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0) { global $db, $conf, $langs; - include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $idprod = (!empty($object->lines[$i]->fk_product) ? $object->lines[$i]->fk_product : false); $label = (!empty($object->lines[$i]->label) ? $object->lines[$i]->label : (!empty($object->lines[$i]->product_label) ? $object->lines[$i]->product_label : '')); @@ -1283,8 +1282,10 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, if (!empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && ($textwasmodified || $translatealsoifmodified)) $note = $prodser->multilangs[$outputlangs->defaultlang]["note"]; } } - elseif ($object->type == Facture::TYPE_DEPOSIT && $object->element == 'facture') { - $desc = str_replace('(DEPOSIT)', $outputlangs->trans('Deposit'), $desc); + elseif ($object->element == 'facture' || $object->element == 'facturefourn') { + if ($object->type == $object::TYPE_DEPOSIT) { + $desc = str_replace('(DEPOSIT)', $outputlangs->trans('Deposit'), $desc); + } } // Description short of product line From 9878eddd7507477ae54c79aa2dadca2c0dea3a4a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Dec 2019 22:52:20 +0100 Subject: [PATCH 15/33] Fix phpcs --- htdocs/core/lib/images.lib.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 532563216eb..fa68301a298 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -324,7 +324,7 @@ function correctExifImageOrientation($fileSource, $fileDest, $quality = 95) { if (function_exists('exif_read_data') ) { $exif = exif_read_data($fileSource); - if($exif && isset($exif['Orientation'])) { + if ($exif && isset($exif['Orientation'])) { $infoImg = getimagesize($fileSource); // Get image infos @@ -438,12 +438,12 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', dol_syslog('This file '.$file.' does not seem to be an image format file name.', LOG_WARNING); return 'ErrorBadImageFormat'; } - elseif(!is_numeric($maxWidth) || empty($maxWidth) || $maxWidth < -1){ + elseif(!is_numeric($maxWidth) || empty($maxWidth) || $maxWidth < -1) { // Si la largeur max est incorrecte (n'est pas numerique, est vide, ou est inferieure a 0) dol_syslog('Wrong value for parameter maxWidth', LOG_ERR); return 'Error: Wrong value for parameter maxWidth'; } - elseif(!is_numeric($maxHeight) || empty($maxHeight) || $maxHeight < -1){ + elseif(!is_numeric($maxHeight) || empty($maxHeight) || $maxHeight < -1) { // Si la hauteur max est incorrecte (n'est pas numerique, est vide, ou est inferieure a 0) dol_syslog('Wrong value for parameter maxHeight', LOG_ERR); return 'Error: Wrong value for parameter maxHeight'; @@ -457,7 +457,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', $exif = exif_read_data($filetoread); $ort= false; - if($exif && !empty($exif['Orientation'])){ + if ($exif && !empty($exif['Orientation'])) { $ort = $exif['Orientation']; } @@ -536,8 +536,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', return 0; } $exifAngle = false; - if($ort && !empty($conf->global->MAIN_USE_EXIF_ROTATION)){ - + if ($ort && !empty($conf->global->MAIN_USE_EXIF_ROTATION)) { switch($ort) { case 3: // 180 rotate left From bde917d7fc7d557e66465a9ec2dce7b522706f32 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Dec 2019 15:09:20 +0100 Subject: [PATCH 16/33] Fix responsive --- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/lib/functions.lib.php | 4 ++-- htdocs/product/card.php | 17 ++++++++++++----- htdocs/product/list.php | 14 ++++++++------ htdocs/theme/eldy/global.inc.php | 8 -------- htdocs/theme/md/style.css.php | 4 ---- 6 files changed, 23 insertions(+), 26 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index cdb55c66049..43064277dca 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3550,7 +3550,7 @@ class Form $return = ''; - $return .= ''; $options = array( 'HT'=>$langs->trans("HT"), 'TTC'=>$langs->trans("TTC") diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c40daaca6c9..59037d18525 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8372,6 +8372,7 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u } $class = 'btnTitle'; + // hidden conf keep during button transition TODO: remove this block if (!empty($conf->global->MAIN_USE_OLD_TITLE_BUTTON)) { $class = 'butActionNew'; @@ -8446,10 +8447,9 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u $tag = (empty($attr['href']) ? 'span' : 'a'); - $button = '<'.$tag.' '.$compiledAttributes.' >'; $button .= ''; - $button .= ''.$label.''; + $button .= ''.$label.''; $button .= ''; // hidden conf keep during button transition TODO: remove this block diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 30032c927cc..48498ac82f7 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1023,7 +1023,9 @@ else require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php'; $formbarcode = new FormBarCode($db); print $formbarcode->selectBarcodeType($fk_barcode_type, 'fk_barcode_type', 1); - print ''.$langs->trans("BarcodeValue").''; + print ''; + if ($conf->browser->layout == 'phone') print ''; + print ''.$langs->trans("BarcodeValue").''; $tmpcode = isset($_POST['barcode']) ?GETPOST('barcode') : $object->barcode; if (empty($tmpcode) && !empty($modBarCodeProduct->code_auto)) $tmpcode = $modBarCodeProduct->getNextValue($object, $type); print ''; @@ -1052,10 +1054,13 @@ else print ''; print ''; print ''; + print ''; + // Stock min level print ''.$form->textwithpicto($langs->trans("StockLimit"), $langs->trans("StockLimitDesc"), 1).''; print ''; print ''; + if ($conf->browser->layout == 'phone') print ''; // Stock desired level print ''.$form->textwithpicto($langs->trans("DesiredStock"), $langs->trans("DesiredStockDesc"), 1).''; print ''; @@ -1094,9 +1099,9 @@ else if (empty($conf->global->PRODUCT_DISABLE_SIZE)) { print ''.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").''; - print ' x '; - print ' x '; - print ''; + print ' x '; + print ' x '; + print ''; print $formproduct->selectMeasuringUnits("size_units", "size", GETPOSTISSET('size_units') ?GETPOST('size_units', 'alpha') : '0', 0, 2); print ''; } @@ -1140,8 +1145,10 @@ else if (empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO) && empty($type)) { print ''.$langs->trans("CustomCode").''; + if ($conf->browser->layout == 'phone') print ''; // Origin country - print ''.$langs->trans("CountryOrigin").''; + print ''.$langs->trans("CountryOrigin").''; + print ''; print $form->select_country(GETPOST('country_id', 'int'), 'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 0e439e03052..05cc5752777 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -481,19 +481,21 @@ if ($resql) $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $newcardbutton = ''; - $rightskey = 'produit'; - if ($type == Product::TYPE_SERVICE) $rightskey = 'service'; - if ($user->rights->{$rightskey}->creer) + if ($type === "") $perm = ($user->rights->produit->creer || $user->rights->service->creer); + elseif ($type == Product::TYPE_SERVICE) $perm = $user->rights->service->creer; + elseif ($type == Product::TYPE_PRODUCT) $perm = $user->rights->produit->creer; + if ($perm) { $oldtype = $type; - + $params = array(); + if ($type === "") $params['forcenohideoftext']=1; if ($type === "") { - $newcardbutton .= dolGetButtonTitle($langs->trans('NewProduct'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type=0'); + $newcardbutton .= dolGetButtonTitle($langs->trans('NewProduct'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type=0', '', 1, $params); $type = Product::TYPE_SERVICE; } $label = 'NewProduct'; if ($type == Product::TYPE_SERVICE) $label = 'NewService'; - $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type='.$type); + $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type='.$type, '', 1, $params); $type = $oldtype; } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 73b0da9323c..975c2a6a0e3 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -5951,17 +5951,9 @@ div.tabsElem a.tab { font-size: 12px; } - .text-plus-circle { - display: none; - } - table.table-fiche-title .col-title div.titre{ line-height: unset; } - - .btnTitle-label { - display: none; - } } Date: Wed, 4 Dec 2019 15:12:18 +0100 Subject: [PATCH 17/33] Fix responsive --- htdocs/takepos/admin/setup.php | 2 ++ htdocs/takepos/admin/terminal.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index 770150ecc4e..a6b475508c9 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -128,6 +128,7 @@ print '
'; print ''; print ''; +print '
'; print ''; print ''; @@ -290,6 +291,7 @@ print $form->selectarray('TAKEPOS_EMAIL_TEMPLATE_INVOICE', $arrayofmessagename, print "\n"; print '
'; +print '
'; print '
'; diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index 1902e522bdf..7e9d974f0a9 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -126,6 +126,7 @@ print ''; print ''; +print '
'; print ''; print ''; print ''; @@ -236,6 +237,7 @@ if (!empty($conf->stock->enabled)) } print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'; +print '
'; if ($atleastonefound == 0 && !empty($conf->banque->enabled)) { From b78f3105082f8791608816406d926d87b7e1c5b8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Dec 2019 15:49:22 +0100 Subject: [PATCH 18/33] Reponsive --- htdocs/core/class/doleditor.class.php | 2 ++ htdocs/product/card.php | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index fc148b94611..8dc99ae592f 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -192,6 +192,7 @@ class DolEditor $out.= ''."\n"; $out.= '