';
- if (!empty($formquestion['text'])) {
+ if (is_array($formquestion) && !empty($formquestion['text'])) {
$formconfirm .= '
'.$formquestion['text'].'
'."\n";
}
if (!empty($more)) {
@@ -4454,7 +4456,7 @@ class Form
$formconfirm .= '
'.img_picto('', 'recent').' '.$title.' '."\n";
// Line text
- if (!empty($formquestion['text'])) {
+ if (is_array($formquestion) && !empty($formquestion['text'])) {
$formconfirm .= '
'.$formquestion['text'].' '."\n";
}
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 32deb0667e8..7251db1476e 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -672,7 +672,7 @@ class FormFile
{
$submodulepart = $modulepart;
- // modulepart = 'nameofmodule' or 'nameofmodule:nameofsubmodule'
+ // modulepart = 'nameofmodule' or 'nameofmodule:NameOfObject'
$tmp = explode(':', $modulepart);
if (!empty($tmp[1])) {
$modulepart = $tmp[0];
@@ -680,18 +680,18 @@ class FormFile
}
// For normalized standard modules
- $file = dol_buildpath('/core/modules/'.$modulepart.'/modules_'.$submodulepart.'.php', 0);
+ $file = dol_buildpath('/core/modules/'.$modulepart.'/modules_'.strtolower($submodulepart).'.php', 0);
if (file_exists($file))
{
$res = include_once $file;
}
// For normalized external modules.
- else
- {
- $file = dol_buildpath('/'.$modulepart.'/core/modules/'.$modulepart.'/modules_'.$submodulepart.'.php', 0);
+ else {
+ $file = dol_buildpath('/'.$modulepart.'/core/modules/'.$modulepart.'/modules_'.strtolower($submodulepart).'.php', 0);
$res = include_once $file;
}
- $class = 'ModelePDF'.ucfirst($submodulepart);
+
+ $class = 'ModelePDF'.$submodulepart;
if (class_exists($class))
{
@@ -1107,7 +1107,7 @@ class FormFile
if ($disablecrop == -1)
{
$disablecrop = 1;
- if (in_array($modulepart, array('bank', 'bom', 'expensereport', 'holiday', 'member', 'mrp', 'project', 'product', 'produit', 'propal', 'service', 'societe', 'tax', 'tax-vat', 'ticket', 'user'))) $disablecrop = 0;
+ if (in_array($modulepart, array('bank', 'bom', 'expensereport', 'holiday', 'medias', 'member', 'mrp', 'project', 'product', 'produit', 'propal', 'service', 'societe', 'tax', 'tax-vat', 'ticket', 'user'))) $disablecrop = 0;
}
// Define relative path used to store the file
@@ -1270,6 +1270,7 @@ class FormFile
{
print '';
$section_dir = dirname(GETPOST('urlfile', 'alpha'));
+ if (! preg_match('/\/$/', $section_dir)) $section_dir.='/';
print '
';
print '
';
print '
';
@@ -1375,11 +1376,11 @@ class FormFile
// Delete or view link
// ($param must start with &)
print '
';
- if ($useinecm == 1 || $useinecm == 5)
+ if ($useinecm == 1 || $useinecm == 5) // ECM manual tree
{
- print ''.img_edit('default', 0, 'class="paddingrightonly"').' ';
+ print ''.img_edit('default', 0, 'class="paddingrightonly"').' ';
}
- if (empty($useinecm) || $useinecm == 2 || $useinecm == 6)
+ if (empty($useinecm) || $useinecm == 2 || $useinecm == 6) // 6=Media file manager
{
$newmodulepart = $modulepart;
if (in_array($modulepart, array('product', 'produit', 'service'))) $newmodulepart = 'produit|service';
@@ -1389,7 +1390,13 @@ class FormFile
if ($permtoeditline)
{
// Link to resize
- print ''.img_picto($langs->trans("ResizeOrCrop"), 'resize', 'class="paddingrightonly"').' ';
+ $moreparaminurl = '';
+ if ($object->id > 0) {
+ $moreparaminurl = '&id='.$object->id;
+ } elseif (GETPOST('website', 'alpha')) {
+ $moreparaminurl = '&website='.GETPOST('website', 'alpha');
+ }
+ print ''.img_picto($langs->trans("ResizeOrCrop"), 'resize', 'class="paddingrightonly"').' ';
}
}
diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php
index 1efa4c88771..9de5ceba476 100644
--- a/htdocs/core/js/lib_head.js.php
+++ b/htdocs/core/js/lib_head.js.php
@@ -880,12 +880,13 @@ function newpopup(url, title) {
*/
function document_preview(file, type, title)
{
- var ValidImageTypes = ["image/gif", "image/jpeg", "image/png"];
+ var ValidImageTypes = ["image/gif", "image/jpeg", "image/png", "image/webp"];
var showOriginalSizeButton = false;
console.log("document_preview A click was done. file="+file+", type="+type+", title="+title);
if ($.inArray(type, ValidImageTypes) < 0) {
+ /* Not an image */
var width='85%';
var object_width='100%';
var height = ($( window ).height() - 60) * 0.90;
@@ -894,6 +895,7 @@ function document_preview(file, type, title)
show_preview('notimage');
} else {
+ /* This is an image */
var object_width=0;
var object_height=0;
@@ -904,11 +906,13 @@ function document_preview(file, type, title)
object_height = this.height;
width = $( window ).width()*0.90;
+ console.log("object_width="+object_width+" window width="+width);
if(object_width < width){
console.log("Object width is small, we set width of popup according to image width.");
width = object_width + 30
}
height = $( window ).height()*0.85;
+ console.log("object_height="+object_height+" window height="+height);
if(object_height < height){
console.log("Object height is small, we set height of popup according to image height.");
height = object_height + 80
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index b30bc99f38a..dd107308fed 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -8055,7 +8055,7 @@ function getImageFileNameForSize($file, $extName, $extImgTarget = '')
$dirName = dirname($file);
if ($dirName == '.') $dirName = '';
- $fileName = preg_replace('/(\.gif|\.jpeg|\.jpg|\.png|\.bmp)$/i', '', $file); // We remove extension, whatever is its case
+ $fileName = preg_replace('/(\.gif|\.jpeg|\.jpg|\.png|\.bmp|\.webp)$/i', '', $file); // We remove extension, whatever is its case
$fileName = basename($fileName);
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.jpg$/i', $file) ? '.jpg' : '');
@@ -8063,6 +8063,7 @@ function getImageFileNameForSize($file, $extName, $extImgTarget = '')
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.gif$/i', $file) ? '.gif' : '');
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.png$/i', $file) ? '.png' : '');
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.bmp$/i', $file) ? '.bmp' : '');
+ if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.webp$/i', $file) ? '.webp' : '');
if (!$extImgTarget) return $file;
@@ -8088,7 +8089,7 @@ function getAdvancedPreviewUrl($modulepart, $relativepath, $alldata = 0, $param
if (empty($conf->use_javascript_ajax)) return '';
- $mime_preview = array('bmp', 'jpeg', 'png', 'gif', 'tiff', 'pdf', 'plain', 'css', 'svg+xml');
+ $mime_preview = array('bmp', 'jpeg', 'png', 'gif', 'tiff', 'pdf', 'plain', 'css', 'svg+xml', 'webp');
//$mime_preview[]='vnd.oasis.opendocument.presentation';
//$mime_preview[]='archive';
$num_mime = array_search(dol_mimetype($relativepath, '', 1), $mime_preview);
@@ -8199,6 +8200,7 @@ function dol_mimetype($file, $default = 'application/octet-stream', $mode = 0)
if (preg_match('/\.bmp$/i', $tmpfile)) { $mime = 'image/bmp'; $imgmime = 'image.png'; $famime = 'file-image-o'; }
if (preg_match('/\.(tif|tiff)$/i', $tmpfile)) { $mime = 'image/tiff'; $imgmime = 'image.png'; $famime = 'file-image-o'; }
if (preg_match('/\.svg$/i', $tmpfile)) { $mime = 'image/svg+xml'; $imgmime = 'image.png'; $famime = 'file-image-o'; }
+ if (preg_match('/\.webp$/i', $tmpfile)) { $mime = 'image/webp'; $imgmime = 'image.png'; $famime = 'file-image-o'; }
// Calendar
if (preg_match('/\.vcs$/i', $tmpfile)) { $mime = 'text/calendar'; $imgmime = 'other.png'; $famime = 'file-text-o'; }
if (preg_match('/\.ics$/i', $tmpfile)) { $mime = 'text/calendar'; $imgmime = 'other.png'; $famime = 'file-text-o'; }
diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php
index 4f65ca3a2bf..b65ad51db86 100644
--- a/htdocs/core/lib/images.lib.php
+++ b/htdocs/core/lib/images.lib.php
@@ -37,7 +37,7 @@ $quality = 80;
*/
function image_format_supported($file)
{
- $regeximgext = '\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.xpm|\.xbm|\.svg'; // See also into product.class.php
+ $regeximgext = '\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.webp|\.xpm|\.xbm|\.svg'; // See also into product.class.php
// Case filename is not a format image
$reg = array();
@@ -46,10 +46,11 @@ function image_format_supported($file)
// Case filename is a format image but not supported by this PHP
$imgfonction = '';
if (strtolower($reg[1]) == '.gif') $imgfonction = 'imagecreatefromgif';
- if (strtolower($reg[1]) == '.png') $imgfonction = 'imagecreatefrompng';
if (strtolower($reg[1]) == '.jpg') $imgfonction = 'imagecreatefromjpeg';
if (strtolower($reg[1]) == '.jpeg') $imgfonction = 'imagecreatefromjpeg';
+ if (strtolower($reg[1]) == '.png') $imgfonction = 'imagecreatefrompng';
if (strtolower($reg[1]) == '.bmp') $imgfonction = 'imagecreatefromwbmp';
+ if (strtolower($reg[1]) == '.webp') $imgfonction = 'imagecreatefromwebp';
if (strtolower($reg[1]) == '.xpm') $imgfonction = 'imagecreatefromxpm';
if (strtolower($reg[1]) == '.xbm') $imgfonction = 'imagecreatefromxbm';
if (strtolower($reg[1]) == '.svg') $imgfonction = 'imagecreatefromsvg'; // Never available
@@ -60,10 +61,12 @@ function image_format_supported($file)
// Fonctions of conversion not available in this PHP
return 0;
}
+
+ // Filename is a format image and supported for conversion by this PHP
+ return 1;
}
- // Filename is a format image and supported for conversion by this PHP
- return 1;
+ return 0;
}
@@ -180,6 +183,9 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
case 4: // IMG_WBMP
$imgfonction = 'imagecreatefromwbmp';
break;
+ case 17: // IMG_WBMP
+ $imgfonction = 'imagecreatefromwebp';
+ break;
}
if ($imgfonction)
{
@@ -213,6 +219,11 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
$extImg = '.bmp';
$newquality = 'NU'; // Quality is not used for this format
break;
+ case 18: // Webp
+ $img = imagecreatefromwebp($filetoread);
+ $extImg = '.webp';
+ $newquality = '100'; // % quality maximum
+ break;
}
// Create empty image
@@ -255,6 +266,9 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
case 4: // Bmp
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0);
break;
+ case 18: // Webp
+ $trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 127);
+ break;
}
if (function_exists("imagefill")) imagefill($imgThumb, 0, 0, $trans_colour);
@@ -283,6 +297,9 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
case 4: // Bmp
imagewbmp($imgThumb, $imgThumbName);
break;
+ case 18: // Webp
+ imagewebp($imgThumb, $imgThumbName, $newquality);
+ break;
}
// Set permissions on file
diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php
index de5bb6d0ddd..39d1d7ca899 100644
--- a/htdocs/core/lib/website2.lib.php
+++ b/htdocs/core/lib/website2.lib.php
@@ -205,6 +205,8 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
$tplcontent .= 'use_manifest) { print \' \'."\n"; } ?>'."\n";
$tplcontent .= ''."\n";
$tplcontent .= ' '."\n";
+ $tplcontent .= ''."\n";
+ $tplcontent .= ''."\n";
$tplcontent .= ''."\n";
$tplcontent .= '/ims\', \'\', file_get_contents(DOL_DATA_ROOT."/website/".$websitekey."/htmlheader.html")); ?>'."\n";
$tplcontent .= ''."\n";
@@ -330,7 +332,7 @@ function dolSaveCssFile($filecss, $csscontent)
}
/**
- * Save content of a page on disk
+ * Save content of a page on disk. For example into documents/website/mywebsite/javascript.js.php file.
*
* @param string $filejs Full path of filename to generate
* @param string $jscontent Content of file
diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php
index 57a94baae9f..ec6f52dfec7 100644
--- a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php
+++ b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php
@@ -342,26 +342,17 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$num = count($this->lines);
for ($j = 0; $j < $num; $j++)
{
- $lineinpage++;
+ // Dynamic max line heigh calculation
+ $dynamic_line_height = array();
+ $dynamic_line_height[] = $pdf->getStringHeight(60, $outputlangs->convToOutputCharset($this->lines[$j]->bank_chq));
+ $dynamic_line_height[] = $pdf->getStringHeight(80, $outputlangs->convToOutputCharset($this->lines[$j]->emetteur_chq));
+ $max_line_height = max($dynamic_line_height);
+ // Calculate number of line used function of estimated line size
+ if ($max_line_height > $this->line_height) $nb_lines = floor($max_line_height / $this->line_height) + 1;
+ else $nb_lines = 1;
- $pdf->SetXY(1, $this->tab_top + 10 + $yp);
- $pdf->MultiCell(8, $this->line_height, $j + 1, 0, 'R', 0);
-
- $pdf->SetXY(10, $this->tab_top + 10 + $yp);
- $pdf->MultiCell(30, $this->line_height, $this->lines[$j]->num_chq ? $this->lines[$j]->num_chq : '', 0, 'L', 0);
-
- $pdf->SetXY(40, $this->tab_top + 10 + $yp);
- $pdf->MultiCell(70, $this->line_height, dol_trunc($outputlangs->convToOutputCharset($this->lines[$j]->bank_chq), 44), 0, 'L', 0);
-
- $pdf->SetXY(100, $this->tab_top + 10 + $yp);
- $pdf->MultiCell(80, $this->line_height, dol_trunc($outputlangs->convToOutputCharset($this->lines[$j]->emetteur_chq), 50), 0, 'L', 0);
-
- $pdf->SetXY(180, $this->tab_top + 10 + $yp);
- $pdf->MultiCell(20, $this->line_height, price($this->lines[$j]->amount_chq), 0, 'R', 0);
-
- $yp = $yp + $this->line_height;
-
- if ($lineinpage >= $this->line_per_page && $j < (count($this->lines) - 1))
+ // Add page break if we do not have space to add current line
+ if ($lineinpage >= ($this->line_per_page - 1))
{
$lineinpage = 0; $yp = 0;
@@ -373,6 +364,25 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0, 0, 0);
}
+
+ $lineinpage += $nb_lines;
+
+ $pdf->SetXY(1, $this->tab_top + 10 + $yp);
+ $pdf->MultiCell(8, $this->line_height, $j + 1, 0, 'R', 0);
+
+ $pdf->SetXY(10, $this->tab_top + 10 + $yp);
+ $pdf->MultiCell(30, $this->line_height, $this->lines[$j]->num_chq ? $this->lines[$j]->num_chq : '', 0, 'L', 0);
+
+ $pdf->SetXY(40, $this->tab_top + 10 + $yp);
+ $pdf->MultiCell(60, $this->line_height, $outputlangs->convToOutputCharset($this->lines[$j]->bank_chq, 44), 0, 'L', 0);
+
+ $pdf->SetXY(100, $this->tab_top + 10 + $yp);
+ $pdf->MultiCell(80, $this->line_height, $outputlangs->convToOutputCharset($this->lines[$j]->emetteur_chq, 50), 0, 'L', 0);
+
+ $pdf->SetXY(180, $this->tab_top + 10 + $yp);
+ $pdf->MultiCell(20, $this->line_height, price($this->lines[$j]->amount_chq), 0, 'R', 0);
+
+ $yp = $yp + ($this->line_height * $nb_lines);
}
}
diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php
index 2686efa6419..fc4d7b9f24c 100644
--- a/htdocs/core/photos_resize.php
+++ b/htdocs/core/photos_resize.php
@@ -40,7 +40,7 @@ $cancel = GETPOST('cancel', 'alpha');
$file = GETPOST('file', 'alpha');
$num = GETPOST('num', 'alpha'); // Used for document on bank statement
-
+$website = GETPOST('website', 'alpha');
// Security check
if (empty($modulepart)) accessforbidden('Bad value for modulepart');
@@ -86,8 +86,12 @@ elseif ($modulepart == 'bank')
$result = restrictedArea($user, 'banque', $id, 'bank_account');
if (!$user->rights->banque->lire) accessforbidden();
$accessallowed = 1;
-}
-else // ticket, holiday, expensereport, societe...
+} elseif ($modulepart == 'medias')
+{
+ $permtoadd = ($user->rights->mailing->creer || $user->rights->website->write);
+ if (!$permtoadd) accessforbidden();
+ $accessallowed = 1;
+} else // ticket, holiday, expensereport, societe...
{
$result = restrictedArea($user, $modulepart, $id, $modulepart);
if (empty($user->rights->$modulepart->read) && empty($user->rights->$modulepart->lire)) accessforbidden();
@@ -224,9 +228,7 @@ elseif ($modulepart == 'bom')
if ($result <= 0) dol_print_error($db, 'Failed to load object');
$dir = $conf->$modulepart->dir_output; // By default
}
-}
-elseif ($modulepart == 'mrp')
-{
+} elseif ($modulepart == 'mrp') {
require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php';
$object = new MO($db);
if ($id > 0)
@@ -235,9 +237,7 @@ elseif ($modulepart == 'mrp')
if ($result <= 0) dol_print_error($db, 'Failed to load object');
$dir = $conf->$modulepart->dir_output; // By default
}
-}
-elseif ($modulepart == 'bank')
-{
+} elseif ($modulepart == 'bank') {
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$object = new Account($db);
if ($id > 0)
@@ -246,8 +246,9 @@ elseif ($modulepart == 'bank')
if ($result <= 0) dol_print_error($db, 'Failed to load object');
$dir = $conf->bank->dir_output; // By default
}
-}
-else {
+} elseif ($modulepart == 'medias') {
+ $dir = $dolibarr_main_data_root.'/'.$modulepart;
+} else {
print 'Action crop for modulepart = '.$modulepart.' is not supported yet by photos_resize.php.';
}
@@ -271,6 +272,12 @@ if (empty($backtourl))
}
elseif (in_array($modulepart, array('bank'))) $backtourl = DOL_URL_ROOT."/compta/bank/document.php?id=".$id.'&file='.urldecode($file);
elseif (in_array($modulepart, array('mrp'))) $backtourl = DOL_URL_ROOT."/mrp/mo_document.php?id=".$id.'&file='.urldecode($file);
+ elseif (in_array($modulepart, array('medias'))) {
+ $section_dir = dirname($file);
+ if (! preg_match('/\/$/', $section_dir)) $section_dir.='/';
+ $backtourl = DOL_URL_ROOT."/website/index.php?action=file_manager&website=".$website.'§ion_dir='.urlencode($section_dir);
+ }
+ // Generic case that should work for everybody else
else $backtourl = DOL_URL_ROOT."/".$modulepart."/".$modulepart."_document.php?id=".$id.'&file='.urldecode($file);
}
@@ -301,7 +308,10 @@ if ($action == 'confirm_resize' && GETPOSTISSET("file") && GETPOSTISSET("sizex")
if ($result == $fullpath)
{
- $object->addThumbs($fullpath);
+ // If image is related to a given object, we create also thumbs.
+ if (is_object($object)) {
+ $object->addThumbs($fullpath);
+ }
// Update/create database for file $fullpath
$rel_filename = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $fullpath);
@@ -371,7 +381,9 @@ if ($action == 'confirm_crop')
if ($result == $fullpath)
{
- $object->addThumbs($fullpath);
+ if (is_object($object)) {
+ $object->addThumbs($fullpath);
+ }
// Update/create database for file $fullpath
$rel_filename = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $fullpath);
diff --git a/htdocs/core/tpl/commonfields_add.tpl.php b/htdocs/core/tpl/commonfields_add.tpl.php
index a31cd3eb778..0bf2a60d0fe 100644
--- a/htdocs/core/tpl/commonfields_add.tpl.php
+++ b/htdocs/core/tpl/commonfields_add.tpl.php
@@ -56,7 +56,8 @@ foreach ($object->fields as $key => $val)
if (in_array($val['type'], array('int', 'integer'))) $value = GETPOST($key, 'int');
elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOST($key, 'none');
else $value = GETPOST($key, 'alpha');
- print $object->showInputField($val, $key, $value, '', '', '', 0);
+ if ($val['noteditable']) print $object->showOutputField($val, $key, $value, '', '', '', 0);
+ else print $object->showInputField($val, $key, $value, '', '', '', 0);
print ' ';
print '';
}
diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql
index dd448ccdb39..bbf25a40a77 100644
--- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql
+++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql
@@ -75,6 +75,8 @@ ALTER TABLE llx_prelevement_bons ADD COLUMN type varchar(16) DEFAULT 'debit-orde
ALTER TABLE llx_ecm_files MODIFY COLUMN src_object_type varchar(64);
+ALTER TABLE llx_document_model MODIFY COLUMN type varchar(64);
+
-- Delete an old index that is duplicated
-- VMYSQL4.1 DROP INDEX ix_fk_product_stock on llx_product_batch;
diff --git a/htdocs/install/mysql/tables/llx_document_model.sql b/htdocs/install/mysql/tables/llx_document_model.sql
index 6fe6913fa68..66b1f3db88f 100644
--- a/htdocs/install/mysql/tables/llx_document_model.sql
+++ b/htdocs/install/mysql/tables/llx_document_model.sql
@@ -25,7 +25,7 @@ create table llx_document_model
rowid integer AUTO_INCREMENT PRIMARY KEY,
nom varchar(50),
entity integer DEFAULT 1 NOT NULL, -- multi company id
- type varchar(20) NOT NULL,
+ type varchar(64) NOT NULL,
libelle varchar(255),
description text
)ENGINE=innodb;
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index a7fa6d2aa55..b42195c02f7 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -452,7 +452,7 @@ SetAsDefault=Set as default
ValueOverwrittenByUserSetup=Warning, this value may be overwritten by user specific setup (each user can set his own clicktodial url)
ExternalModule=External module
InstalledInto=Installed into directory %s
-BarcodeInitForthird-parties=Mass barcode init for third-parties
+BarcodeInitForThirdparties=Mass barcode init for third-parties
BarcodeInitForProductsOrServices=Mass barcode init or reset for products or services
CurrentlyNWithoutBarCode=Currently, you have
%s record on
%s %s without barcode defined.
InitEmptyBarCode=Init value for next %s empty records
diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang
index 52c2004c1c7..8d1f50007ea 100644
--- a/htdocs/langs/en_US/cashdesk.lang
+++ b/htdocs/langs/en_US/cashdesk.lang
@@ -107,4 +107,6 @@ OrderPrinterToUse=Order printer to use
MainTemplateToUse=Main template to use
OrderTemplateToUse=Order template to use
BarRestaurant=Bar Restaurant
-AutoOrder=Customer auto order
\ No newline at end of file
+AutoOrder=Customer auto order
+RestaurantMenu=Menu
+CustomerMenu=Customer menu
\ No newline at end of file
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index 8c992bf91ca..532edcb6a67 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -840,6 +840,7 @@ Sincerely=Sincerely
ConfirmDeleteObject=Are you sure you want to delete this object?
DeleteLine=Delete line
ConfirmDeleteLine=Are you sure you want to delete this line?
+ErrorPDFTkOutputFileNotFound=Error: the file was not generated. Please check that the 'pdftk' command is installed in a directory included in the $PATH environment variable (linux/unix only) or contact your system administrator.
NoPDFAvailableForDocGenAmongChecked=No PDF were available for the document generation among checked record
TooManyRecordForMassAction=Too many records selected for mass action. The action is restricted to a list of %s records.
NoRecordSelected=No record selected
@@ -1032,4 +1033,4 @@ DeleteFileHeader=Confirm file delete
DeleteFileText=Do you really want delete this file?
ShowOtherLanguages=Show other languages
SwitchInEditModeToAddTranslation=Switch in edit mode to add translations for this language
-NotUsedForThisCustomer=Not used for this customer
\ No newline at end of file
+NotUsedForThisCustomer=Not used for this customer
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index 2a01a282a90..7e6355b2a30 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -926,6 +926,9 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
dolReplaceInFile($destdir.'/core/modules/mod'.$module.'.class.php', $arrayreplacement, '', 0, 0, 1);
}
+ // TODO Update entries '$myTmpObjects['MyObject']=array('includerefgeneration'=>0, 'includedocgeneration'=>0);'
+
+
// Scan for object class files
$listofobject = dol_dir_list($destdir.'/class', 'files', 0, '\.class\.php$');
diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php
index 8a116783637..d66ede05696 100644
--- a/htdocs/modulebuilder/template/admin/setup.php
+++ b/htdocs/modulebuilder/template/admin/setup.php
@@ -257,7 +257,8 @@ $myTmpObjects = array();
$myTmpObjects['MyObject']=array('includerefgeneration'=>0, 'includedocgeneration'=>0);
-foreach($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
+foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
+ if ($myTmpObjectKey == 'MyObject') continue;
if ($myTmpObjectArray['includerefgeneration']) {
/*
* Orders Numbering model
diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php
index 7dc98dbf1e7..057a2aab615 100644
--- a/htdocs/modulebuilder/template/class/myobject.class.php
+++ b/htdocs/modulebuilder/template/class/myobject.class.php
@@ -530,8 +530,8 @@ class MyObject extends CommonObject
return 0;
}
- /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->myobject->create))
- || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->myobject->myobject_advance->validate))))
+ /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->mymodule->myobject->write))
+ || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->mymodule->myobject->myobject_advance->validate))))
{
$this->error='NotEnoughPermissions';
dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
index 74dbac7b870..3deba218b59 100644
--- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
+++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
@@ -407,31 +407,40 @@ class modMyModule extends DolibarrModules
$sql = array();
- // ODT template
- /*
- $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/mymodule/template_myobjects.odt';
- $dirodt=DOL_DATA_ROOT.'/doctemplates/mymodule';
- $dest=$dirodt.'/template_myobjects.odt';
+ // Document templates
+ $moduledir = 'mymodule';
+ $myTmpObjects = array();
+ $myTmpObjects['MyObject']=array('includerefgeneration'=>0, 'includedocgeneration'=>0);
- if (file_exists($src) && ! file_exists($dest))
- {
- require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
- dol_mkdir($dirodt);
- $result=dol_copy($src, $dest, 0, 0);
- if ($result < 0)
- {
- $langs->load("errors");
- $this->error=$langs->trans('ErrorFailToCopyFile', $src, $dest);
- return 0;
+ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
+ if ($myTmpObjectKey == 'MyObject') continue;
+ if ($myTmpObjectArray['includerefgeneration']) {
+ $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/mymodule/template_myobjects.odt';
+ $dirodt=DOL_DATA_ROOT.'/doctemplates/mymodule';
+ $dest=$dirodt.'/template_myobjects.odt';
+
+ if (file_exists($src) && ! file_exists($dest))
+ {
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+ dol_mkdir($dirodt);
+ $result=dol_copy($src, $dest, 0, 0);
+ if ($result < 0)
+ {
+ $langs->load("errors");
+ $this->error=$langs->trans('ErrorFailToCopyFile', $src, $dest);
+ return 0;
+ }
+ }
+
+ $sql = array_merge($sql, array(
+ "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey)."' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".$conf->entity,
+ "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey)."','".strtolower($myTmpObjectKey)."',".$conf->entity.")",
+ "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey)."_odt' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".$conf->entity,
+ "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey)."_odt', '".strtolower($myTmpObjectKey)."', ".$conf->entity.")"
+ ));
}
}
- $sql = array(
- "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'mymodule' AND entity = ".$conf->entity,
- "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','mymodule',".$conf->entity.")"
- );
- */
-
return $this->_init($sql, $options);
}
diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php
index 4c0ff154a04..7c242c26444 100644
--- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php
+++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php
@@ -358,10 +358,10 @@ class pdf_standard_myobject extends ModelePDFMyObject
$pdf->SetDrawColor(128, 128, 128);
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
- $pdf->SetSubject($outputlangs->transnoentities("PdfInvoiceTitle"));
+ $pdf->SetSubject($outputlangs->transnoentities("PdfTitle"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
- $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfInvoiceTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
+ $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
// Set certificate
@@ -633,22 +633,6 @@ class pdf_standard_myobject extends ModelePDFMyObject
$pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut
- // VAT Rate
- if ($this->getColumnStatus('vat'))
- {
- $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
- $this->printStdColumnContent($pdf, $curY, 'vat', $vat_rate);
- $nexY = max($pdf->GetY(), $nexY);
- }
-
- // Unit price before discount
- if ($this->getColumnStatus('subprice'))
- {
- $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails);
- $this->printStdColumnContent($pdf, $curY, 'subprice', $up_excl_tax);
- $nexY = max($pdf->GetY(), $nexY);
- }
-
// Quantity
// Enough for 6 chars
if ($this->getColumnStatus('qty'))
@@ -658,38 +642,6 @@ class pdf_standard_myobject extends ModelePDFMyObject
$nexY = max($pdf->GetY(), $nexY);
}
- // Situation progress
- if ($this->getColumnStatus('progress'))
- {
- $progress = pdf_getlineprogress($object, $i, $outputlangs, $hidedetails);
- $this->printStdColumnContent($pdf, $curY, 'progress', $progress);
- $nexY = max($pdf->GetY(), $nexY);
- }
-
- // Unit
- if ($this->getColumnStatus('unit'))
- {
- $unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager);
- $this->printStdColumnContent($pdf, $curY, 'unit', $unit);
- $nexY = max($pdf->GetY(), $nexY);
- }
-
- // Discount on line
- if ($this->getColumnStatus('discount') && $object->lines[$i]->remise_percent)
- {
- $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails);
- $this->printStdColumnContent($pdf, $curY, 'discount', $remise_percent);
- $nexY = max($pdf->GetY(), $nexY);
- }
-
- // Total HT line
- if ($this->getColumnStatus('totalexcltax'))
- {
- $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails);
- $this->printStdColumnContent($pdf, $curY, 'totalexcltax', $total_excl_tax);
- $nexY = max($pdf->GetY(), $nexY);
- }
-
// Extrafields
if (!empty($object->lines[$i]->array_options)) {
foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
@@ -716,7 +668,6 @@ class pdf_standard_myobject extends ModelePDFMyObject
$sign = 1;
- if (isset($object->type) && $object->type == 2 && !empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign = -1;
// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
$prev_progress = $object->lines[$i]->get_prev_progress($object->id);
if ($prev_progress > 0 && !empty($object->lines[$i]->situation_percent)) // Compute progress from previous situation
@@ -1006,21 +957,10 @@ class pdf_standard_myobject extends ModelePDFMyObject
$pdf->SetFont('', 'B', $default_font_size + 3);
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
- $title = $outputlangs->transnoentities("PdfInvoiceTitle");
- if ($object->type == 1) $title = $outputlangs->transnoentities("InvoiceReplacement");
- if ($object->type == 2) $title = $outputlangs->transnoentities("InvoiceAvoir");
- if ($object->type == 3) $title = $outputlangs->transnoentities("InvoiceDeposit");
- if ($object->type == 4) $title = $outputlangs->transnoentities("InvoiceProForma");
- if ($this->situationinvoice) $title = $outputlangs->transnoentities("InvoiceSituation");
+ $title = $outputlangs->transnoentities("PdfTitle");
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && is_object($outputlangsbis)) {
$title .= ' - ';
- if ($object->type == 0) {
- if ($this->situationinvoice) $title .= $outputlangsbis->transnoentities("InvoiceSituation");
- $title .= $outputlangsbis->transnoentities("PdfInvoiceTitle");
- } elseif ($object->type == 1) $title .= $outputlangsbis->transnoentities("InvoiceReplacement");
- elseif ($object->type == 2) $title .= $outputlangsbis->transnoentities("InvoiceAvoir");
- elseif ($object->type == 3) $title .= $outputlangsbis->transnoentities("InvoiceDeposit");
- elseif ($object->type == 4) $title .= $outputlangsbis->transnoentities("InvoiceProForma");
+ $title .= $outputlangsbis->transnoentities("PdfTitle");
}
$pdf->MultiCell($w, 3, $title, '', 'R');
diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php b/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php
index a16f56e137c..78711e33a4d 100644
--- a/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php
+++ b/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php
@@ -51,7 +51,7 @@ abstract class ModelePDFMyObject extends CommonDocGenerator
// phpcs:enable
global $conf;
- $type = 'mymodule_myobject';
+ $type = 'myobject';
$list = array();
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php
index 07850c17491..ceeb30d5d3e 100644
--- a/htdocs/modulebuilder/template/myobject_card.php
+++ b/htdocs/modulebuilder/template/myobject_card.php
@@ -569,8 +569,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$filedir = $conf->mymodule->dir_output.'/'.$object->element.'/'.$objref;
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
$genallowed = $user->rights->mymodule->myobject->read; // If you can read, you can build the PDF to read content
- $delallowed = $user->rights->mymodule->myobject->create; // If you can create/edit, you can remove a file on card
- print $formfile->showdocuments('mymodule:myobject', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
+ $delallowed = $user->rights->mymodule->myobject->write; // If you can create/edit, you can remove a file on card
+ print $formfile->showdocuments('mymodule:MyObject', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
}
// Show links to link elements
diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php
index 0eeddd15c07..903eedd3e8a 100644
--- a/htdocs/product/class/html.formproduct.class.php
+++ b/htdocs/product/class/html.formproduct.class.php
@@ -237,13 +237,14 @@ class FormProduct
*/
public function selectWarehouses($selected = '', $htmlname = 'idwarehouse', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $empty_label = '', $showstock = 0, $forcecombo = 0, $events = array(), $morecss = 'minwidth200', $exclude = '', $showfullpath = 1, $stockMin = false, $orderBy = 'e.ref')
{
- global $conf, $langs, $user;
+ global $conf, $langs, $user, $hookmanager;
dol_syslog(get_class($this)."::selectWarehouses $selected, $htmlname, $filterstatus, $empty, $disabled, $fk_product, $empty_label, $showstock, $forcecombo, $morecss", LOG_DEBUG);
$out = '';
if (empty($conf->global->ENTREPOT_EXTRA_STATUS)) $filterstatus = '';
if (!empty($fk_product)) $this->cache_warehouses = array();
+
$this->loadWarehouses($fk_product, '', $filterstatus, true, $exclude, $stockMin, $orderBy);
$nbofwarehouses = count($this->cache_warehouses);
@@ -287,6 +288,28 @@ class FormProduct
$out .= '';
if ($disabled) $out .= '
';
+ $parameters = array(
+ 'selected' => $selected,
+ 'htmlname' => $htmlname,
+ 'filterstatus' => $filterstatus,
+ 'empty' => $empty,
+ 'disabled ' => $disabled,
+ 'fk_product' => $fk_product,
+ 'empty_label' => $empty_label,
+ 'showstock' => $showstock,
+ 'forcecombo' => $forcecombo,
+ 'events' => $events,
+ 'morecss' => $morecss,
+ 'exclude' => $exclude,
+ 'showfullpath' => $showfullpath,
+ 'stockMin' => $stockMin,
+ 'orderBy' => $orderBy
+ );
+
+ $reshook = $hookmanager->executeHooks('selectWarehouses', $parameters, $this);
+ if ($reshook > 0) $out = $hookmanager->resPrint;
+ elseif ($reshook == 0) $out .= $hookmanager->resPrint;
+
return $out;
}
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 7b6892552d1..d557dd90392 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -79,7 +79,7 @@ class Product extends CommonObject
*/
protected $table_ref_field = 'ref';
- public $regeximgext = '\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.xpm|\.xbm'; // See also into images.lib.php
+ public $regeximgext = '\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.webp|\.xpm|\.xbm'; // See also into images.lib.php
/*
* @deprecated
diff --git a/htdocs/takepos/admin/bar.php b/htdocs/takepos/admin/bar.php
index 2508ab56040..0f47990cb4a 100644
--- a/htdocs/takepos/admin/bar.php
+++ b/htdocs/takepos/admin/bar.php
@@ -52,9 +52,7 @@ if (GETPOST('action', 'alpha') == 'set')
{
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
- }
- else
- {
+ } else {
$db->rollback();
setEventMessages($langs->trans("Error"), null, 'errors');
}
@@ -129,11 +127,17 @@ if ($conf->global->TAKEPOS_SUPPLEMENTS)
}
print '
';
-print $langs->trans("AutoOrder");
+print 'QR - '.$langs->trans("AutoOrder");
print ' ';
print ajax_constantonoff("TAKEPOS_AUTO_ORDER", array(), $conf->entity, 0, 0, 1, 0);
print ' ';
+print '
';
+print 'QR - '.$langs->trans("CustomerMenu");
+print ' ';
+print ajax_constantonoff("TAKEPOS_QR_MENU", array(), $conf->entity, 0, 0, 1, 0);
+print ' ';
+
print '';
@@ -157,13 +161,30 @@ if ($conf->global->TAKEPOS_AUTO_ORDER)
print '
';
print "".$urlwithroot."/takepos/public/auto_order.php?key=".dol_encode($row['rowid'])." ";
print ' ';
- print " ";
+ print " ";
print ' ';
}
print '';
}
+if ($conf->global->TAKEPOS_QR_MENU)
+{
+ $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
+ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
+ print '
';
+ print '
';
+}
+
print '
';
print '