Merge remote-tracking branch 'Dolibarr/12.0' into 12

This commit is contained in:
Francis Appels 2020-06-03 14:34:51 +02:00
commit d41f2dcd86
38 changed files with 653 additions and 231 deletions

View File

@ -18,6 +18,7 @@ NEW: Accountancy - Add mode intra & export for product or service bought
NEW: Accountancy - Add possibility to manage a short alternative label for account - Use to simplify accountancy NEW: Accountancy - Add possibility to manage a short alternative label for account - Use to simplify accountancy
NEW: Accountancy - General ledger - Add an option to search not reconciled lines NEW: Accountancy - General ledger - Add an option to search not reconciled lines
NEW: Add accountancy code of thirdparty in contact and supplier export NEW: Add accountancy code of thirdparty in contact and supplier export
NEW: support webp image format
NEW: add a link to notes in members list NEW: add a link to notes in members list
NEW: add a parameter to group same products in TakePOS NEW: add a parameter to group same products in TakePOS
NEW: add a parameter to sort product by label in TakePOS NEW: add a parameter to sort product by label in TakePOS

View File

@ -495,7 +495,9 @@ if (!empty($mysoc->logo_mini)) {
} }
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>'; print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
} else { } else {
print '<div class="inline-block valignmiddle">';
print '<img height="60" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">'; print '<img height="60" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
print '</div>';
} }
print '</div>'; print '</div>';
print '</td></tr>'; print '</td></tr>';
@ -513,7 +515,9 @@ if (!empty($mysoc->logo_squarred_mini)) {
} }
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>'; print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
} else { } else {
print '<div class="inline-block valignmiddle">';
print '<img height="60" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">'; print '<img height="60" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
print '</div>';
} }
print '</div>'; print '</div>';
print '</td></tr>'; print '</td></tr>';

View File

@ -211,7 +211,7 @@ if ($conf->societe->enabled)
{ {
$nbno = $nbtotal = 0; $nbno = $nbtotal = 0;
print load_fiche_titre($langs->trans("BarcodeInitForThirdparties"), '', 'title_companies'); print load_fiche_titre($langs->trans("BarcodeInitForThirdparties"), '', 'company');
print '<br>'."\n"; print '<br>'."\n";
$sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."societe where barcode IS NULL or barcode = ''"; $sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."societe where barcode IS NULL or barcode = ''";

View File

@ -1160,7 +1160,7 @@ if (empty($reshook))
elseif ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate) elseif ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate)
{ {
$idwarehouse = GETPOST('idwarehouse'); $idwarehouse = GETPOST('idwarehouse', 'int');
$qualified_for_stock_change = 0; $qualified_for_stock_change = 0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) if (empty($conf->global->STOCK_SUPPORTS_SERVICES))
@ -1269,7 +1269,7 @@ if (empty($reshook))
elseif ($action == 'confirm_cancel' && $confirm == 'yes' && $usercanvalidate) elseif ($action == 'confirm_cancel' && $confirm == 'yes' && $usercanvalidate)
{ {
$idwarehouse = GETPOST('idwarehouse'); $idwarehouse = GETPOST('idwarehouse', 'int');
$qualified_for_stock_change = 0; $qualified_for_stock_change = 0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) if (empty($conf->global->STOCK_SUPPORTS_SERVICES))

View File

@ -913,9 +913,10 @@ if (!$error && $massaction == 'cancelorders')
setEventMessages($langs->trans("ErrorObjectMustHaveStatusValidToBeCanceled", $cmd->ref), null, 'errors'); setEventMessages($langs->trans("ErrorObjectMustHaveStatusValidToBeCanceled", $cmd->ref), null, 'errors');
$error++; $error++;
break; break;
} } else {
else // TODO We do not provide warehouse so no stock change here for the moment.
$result = $cmd->cancel(); $result = $cmd->cancel();
}
if ($result < 0) if ($result < 0)
{ {
@ -1028,14 +1029,18 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto
$input_files .= ' '.escapeshellarg($f); $input_files .= ' '.escapeshellarg($f);
} }
$cmd = 'pdftk '.escapeshellarg($input_files).' cat output '.escapeshellarg($file); $cmd = 'pdftk ' . $input_files . ' cat output '.escapeshellarg($file);
exec($cmd); exec($cmd);
if (!empty($conf->global->MAIN_UMASK)) // check if pdftk is installed
@chmod($file, octdec($conf->global->MAIN_UMASK)); if (file_exists($file)) {
if (!empty($conf->global->MAIN_UMASK))
$langs->load("exports"); @chmod($file, octdec($conf->global->MAIN_UMASK));
setEventMessages($langs->trans('FileSuccessfullyBuilt', $filename.'_'.dol_print_date($now, 'dayhourlog')), null, 'mesgs'); $langs->load("exports");
setEventMessages($langs->trans('FileSuccessfullyBuilt', $filename.'_'.dol_print_date($now, 'dayhourlog')), null, 'mesgs');
} else {
setEventMessages($langs->trans('ErrorPDFTkOutputFileNotFound'), null, 'errors');
}
} }
else else
{ {

View File

@ -61,15 +61,16 @@ if (!isset($mode) || $mode != 'noajax') // For ajax call
$upload_dir = dirname(str_replace("../", "/", $rootdirfordoc.'/'.$file)); $upload_dir = dirname(str_replace("../", "/", $rootdirfordoc.'/'.$file));
$ecmdir = new EcmDirectory($db); $ecmdir = new EcmDirectory($db);
$result = $ecmdir->fetch($section); if ($section > 0) {
if (!$result > 0) $result = $ecmdir->fetch($section);
{ if (!$result > 0)
//dol_print_error($db,$ecmdir->error); {
//exit; //dol_print_error($db,$ecmdir->error);
} //exit;
} }
else // For no ajax call }
} else // For no ajax call
{ {
$rootdirfordoc = $conf->ecm->dir_output; $rootdirfordoc = $conf->ecm->dir_output;

View File

@ -6316,7 +6316,7 @@ abstract class CommonObject
// Several field into label (eq table:code|libelle:rowid) // Several field into label (eq table:code|libelle:rowid)
$notrans = false; $notrans = false;
$fields_label = explode('|', $InfoFieldList[1]); $fields_label = explode('|', $InfoFieldList[1]);
if (is_array($fields_label)) if (count($fields_label) > 1)
{ {
$notrans = true; $notrans = true;
foreach ($fields_label as $field_toshow) foreach ($fields_label as $field_toshow)
@ -6488,7 +6488,7 @@ abstract class CommonObject
$notrans = false; $notrans = false;
// Several field into label (eq table:code|libelle:rowid) // Several field into label (eq table:code|libelle:rowid)
$fields_label = explode('|', $InfoFieldList[1]); $fields_label = explode('|', $InfoFieldList[1]);
if (is_array($fields_label)) { if (count($fields_label) > 1) {
$notrans = true; $notrans = true;
foreach ($fields_label as $field_toshow) { foreach ($fields_label as $field_toshow) {
$labeltoshow .= $obj->$field_toshow.' '; $labeltoshow .= $obj->$field_toshow.' ';
@ -7915,6 +7915,10 @@ abstract class CommonObject
{ {
if (is_null($value)) return 'NULL'; if (is_null($value)) return 'NULL';
elseif (preg_match('/^(int|double|real|price)/i', $fieldsentry['type'])) return $this->db->escape("$value"); elseif (preg_match('/^(int|double|real|price)/i', $fieldsentry['type'])) return $this->db->escape("$value");
elseif ($fieldsentry['type'] == 'boolean') {
if ($value) return 'true';
else return 'false';
}
else return "'".$this->db->escape($value)."'"; else return "'".$this->db->escape($value)."'";
} }

View File

@ -2523,6 +2523,8 @@ class Form
$outdurationvalue = $outtype == Product::TYPE_SERVICE ?substr($objp->duration, 0, dol_strlen($objp->duration) - 1) : ''; $outdurationvalue = $outtype == Product::TYPE_SERVICE ?substr($objp->duration, 0, dol_strlen($objp->duration) - 1) : '';
$outdurationunit = $outtype == Product::TYPE_SERVICE ?substr($objp->duration, -1) : ''; $outdurationunit = $outtype == Product::TYPE_SERVICE ?substr($objp->duration, -1) : '';
if ($outorigin && !empty($conf->global->PRODUCT_SHOW_ORIGIN_IN_COMBO)) require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
// Units // Units
$outvalUnits = ''; $outvalUnits = '';
if (!empty($conf->global->PRODUCT_USE_UNITS)) { if (!empty($conf->global->PRODUCT_USE_UNITS)) {
@ -4192,18 +4194,18 @@ class Form
* print '});'."\n"; * print '});'."\n";
* print '</script>'."\n"; * print '</script>'."\n";
* *
* @param string $page Url of page to call if confirmation is OK. Can contains parameters (param 'action' and 'confirm' will be reformated) * @param string $page Url of page to call if confirmation is OK. Can contains parameters (param 'action' and 'confirm' will be reformated)
* @param string $title Title * @param string $title Title
* @param string $question Question * @param string $question Question
* @param string $action Action * @param string $action Action
* @param array $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , )) * @param array|string $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , ))
* type can be 'hidden', 'text', 'password', 'checkbox', 'radio', 'date', 'morecss', ... * type can be 'hidden', 'text', 'password', 'checkbox', 'radio', 'date', 'morecss', ...
* @param string $selectedchoice '' or 'no', or 'yes' or '1' or '0' * @param string $selectedchoice '' or 'no', or 'yes' or '1' or '0'
* @param int|string $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx * @param int|string $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx
* @param int $height Force height of box (0 = auto) * @param int $height Force height of box (0 = auto)
* @param int $width Force width of box ('999' or '90%'). Ignored and forced to 90% on smartphones. * @param int $width Force width of box ('999' or '90%'). Ignored and forced to 90% on smartphones.
* @param int $disableformtag 1=Disable form tag. Can be used if we are already inside a <form> section. * @param int $disableformtag 1=Disable form tag. Can be used if we are already inside a <form> section.
* @return string HTML ajax code if a confirm ajax popup is required, Pure HTML code if it's an html form * @return string HTML ajax code if a confirm ajax popup is required, Pure HTML code if it's an html form
*/ */
public function formconfirm($page, $title, $question, $action, $formquestion = '', $selectedchoice = '', $useajax = 0, $height = 0, $width = 500, $disableformtag = 0) public function formconfirm($page, $title, $question, $action, $formquestion = '', $selectedchoice = '', $useajax = 0, $height = 0, $width = 500, $disableformtag = 0)
{ {
@ -4357,7 +4359,7 @@ class Form
} }
// Show JQuery confirm box. // Show JQuery confirm box.
$formconfirm .= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">'; $formconfirm .= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">';
if (!empty($formquestion['text'])) { if (is_array($formquestion) && !empty($formquestion['text'])) {
$formconfirm .= '<div class="confirmtext">'.$formquestion['text'].'</div>'."\n"; $formconfirm .= '<div class="confirmtext">'.$formquestion['text'].'</div>'."\n";
} }
if (!empty($more)) { if (!empty($more)) {
@ -4454,7 +4456,7 @@ class Form
$formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="3">'.img_picto('', 'recent').' '.$title.'</td></tr>'."\n"; $formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="3">'.img_picto('', 'recent').' '.$title.'</td></tr>'."\n";
// Line text // Line text
if (!empty($formquestion['text'])) { if (is_array($formquestion) && !empty($formquestion['text'])) {
$formconfirm .= '<tr class="valid"><td class="valid" colspan="3">'.$formquestion['text'].'</td></tr>'."\n"; $formconfirm .= '<tr class="valid"><td class="valid" colspan="3">'.$formquestion['text'].'</td></tr>'."\n";
} }

View File

@ -672,7 +672,7 @@ class FormFile
{ {
$submodulepart = $modulepart; $submodulepart = $modulepart;
// modulepart = 'nameofmodule' or 'nameofmodule:nameofsubmodule' // modulepart = 'nameofmodule' or 'nameofmodule:NameOfObject'
$tmp = explode(':', $modulepart); $tmp = explode(':', $modulepart);
if (!empty($tmp[1])) { if (!empty($tmp[1])) {
$modulepart = $tmp[0]; $modulepart = $tmp[0];
@ -680,18 +680,18 @@ class FormFile
} }
// For normalized standard modules // 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)) if (file_exists($file))
{ {
$res = include_once $file; $res = include_once $file;
} }
// For normalized external modules. // For normalized external modules.
else else {
{ $file = dol_buildpath('/'.$modulepart.'/core/modules/'.$modulepart.'/modules_'.strtolower($submodulepart).'.php', 0);
$file = dol_buildpath('/'.$modulepart.'/core/modules/'.$modulepart.'/modules_'.$submodulepart.'.php', 0);
$res = include_once $file; $res = include_once $file;
} }
$class = 'ModelePDF'.ucfirst($submodulepart);
$class = 'ModelePDF'.$submodulepart;
if (class_exists($class)) if (class_exists($class))
{ {
@ -1107,7 +1107,7 @@ class FormFile
if ($disablecrop == -1) if ($disablecrop == -1)
{ {
$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 // Define relative path used to store the file
@ -1270,6 +1270,7 @@ class FormFile
{ {
print '</a>'; print '</a>';
$section_dir = dirname(GETPOST('urlfile', 'alpha')); $section_dir = dirname(GETPOST('urlfile', 'alpha'));
if (! preg_match('/\/$/', $section_dir)) $section_dir.='/';
print '<input type="hidden" name="section_dir" value="'.$section_dir.'">'; print '<input type="hidden" name="section_dir" value="'.$section_dir.'">';
print '<input type="hidden" name="renamefilefrom" value="'.dol_escape_htmltag($file['name']).'">'; print '<input type="hidden" name="renamefilefrom" value="'.dol_escape_htmltag($file['name']).'">';
print '<input type="text" name="renamefileto" class="quatrevingtpercent" value="'.dol_escape_htmltag($file['name']).'">'; print '<input type="text" name="renamefileto" class="quatrevingtpercent" value="'.dol_escape_htmltag($file['name']).'">';
@ -1375,11 +1376,11 @@ class FormFile
// Delete or view link // Delete or view link
// ($param must start with &) // ($param must start with &)
print '<td class="valignmiddle right actionbuttons nowraponall"><!-- action on files -->'; print '<td class="valignmiddle right actionbuttons nowraponall"><!-- action on files -->';
if ($useinecm == 1 || $useinecm == 5) if ($useinecm == 1 || $useinecm == 5) // ECM manual tree
{ {
print '<a href="'.DOL_URL_ROOT.'/ecm/file_card.php?urlfile='.urlencode($file['name']).$param.'" class="editfilelink" rel="'.urlencode($file['name']).'">'.img_edit('default', 0, 'class="paddingrightonly"').'</a>'; print '<a class="editfielda" href="'.DOL_URL_ROOT.'/ecm/file_card.php?urlfile='.urlencode($file['name']).$param.'" class="editfilelink" rel="'.urlencode($file['name']).'">'.img_edit('default', 0, 'class="paddingrightonly"').'</a>';
} }
if (empty($useinecm) || $useinecm == 2 || $useinecm == 6) if (empty($useinecm) || $useinecm == 2 || $useinecm == 6) // 6=Media file manager
{ {
$newmodulepart = $modulepart; $newmodulepart = $modulepart;
if (in_array($modulepart, array('product', 'produit', 'service'))) $newmodulepart = 'produit|service'; if (in_array($modulepart, array('product', 'produit', 'service'))) $newmodulepart = 'produit|service';
@ -1389,7 +1390,13 @@ class FormFile
if ($permtoeditline) if ($permtoeditline)
{ {
// Link to resize // Link to resize
print '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?modulepart='.urlencode($newmodulepart).'&id='.$object->id.'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension'])).'" title="'.dol_escape_htmltag($langs->trans("ResizeOrCrop")).'">'.img_picto($langs->trans("ResizeOrCrop"), 'resize', 'class="paddingrightonly"').'</a>'; $moreparaminurl = '';
if ($object->id > 0) {
$moreparaminurl = '&id='.$object->id;
} elseif (GETPOST('website', 'alpha')) {
$moreparaminurl = '&website='.GETPOST('website', 'alpha');
}
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/core/photos_resize.php?modulepart='.urlencode($newmodulepart).$moreparaminurl.'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension'])).'" title="'.dol_escape_htmltag($langs->trans("ResizeOrCrop")).'">'.img_picto($langs->trans("ResizeOrCrop"), 'resize', 'class="paddingrightonly"').'</a>';
} }
} }

View File

@ -880,12 +880,13 @@ function newpopup(url, title) {
*/ */
function document_preview(file, type, 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; var showOriginalSizeButton = false;
console.log("document_preview A click was done. file="+file+", type="+type+", title="+title); console.log("document_preview A click was done. file="+file+", type="+type+", title="+title);
if ($.inArray(type, ValidImageTypes) < 0) { if ($.inArray(type, ValidImageTypes) < 0) {
/* Not an image */
var width='85%'; var width='85%';
var object_width='100%'; var object_width='100%';
var height = ($( window ).height() - 60) * 0.90; var height = ($( window ).height() - 60) * 0.90;
@ -894,6 +895,7 @@ function document_preview(file, type, title)
show_preview('notimage'); show_preview('notimage');
} else { } else {
/* This is an image */
var object_width=0; var object_width=0;
var object_height=0; var object_height=0;
@ -904,11 +906,13 @@ function document_preview(file, type, title)
object_height = this.height; object_height = this.height;
width = $( window ).width()*0.90; width = $( window ).width()*0.90;
console.log("object_width="+object_width+" window width="+width);
if(object_width < width){ if(object_width < width){
console.log("Object width is small, we set width of popup according to image width."); console.log("Object width is small, we set width of popup according to image width.");
width = object_width + 30 width = object_width + 30
} }
height = $( window ).height()*0.85; height = $( window ).height()*0.85;
console.log("object_height="+object_height+" window height="+height);
if(object_height < height){ if(object_height < height){
console.log("Object height is small, we set height of popup according to image height."); console.log("Object height is small, we set height of popup according to image height.");
height = object_height + 80 height = object_height + 80

View File

@ -8055,7 +8055,7 @@ function getImageFileNameForSize($file, $extName, $extImgTarget = '')
$dirName = dirname($file); $dirName = dirname($file);
if ($dirName == '.') $dirName = ''; 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); $fileName = basename($fileName);
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.jpg$/i', $file) ? '.jpg' : ''); 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('/\.gif$/i', $file) ? '.gif' : '');
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.png$/i', $file) ? '.png' : ''); 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('/\.bmp$/i', $file) ? '.bmp' : '');
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.webp$/i', $file) ? '.webp' : '');
if (!$extImgTarget) return $file; if (!$extImgTarget) return $file;
@ -8088,7 +8089,7 @@ function getAdvancedPreviewUrl($modulepart, $relativepath, $alldata = 0, $param
if (empty($conf->use_javascript_ajax)) return ''; 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[]='vnd.oasis.opendocument.presentation';
//$mime_preview[]='archive'; //$mime_preview[]='archive';
$num_mime = array_search(dol_mimetype($relativepath, '', 1), $mime_preview); $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('/\.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('/\.(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('/\.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 // Calendar
if (preg_match('/\.vcs$/i', $tmpfile)) { $mime = 'text/calendar'; $imgmime = 'other.png'; $famime = 'file-text-o'; } 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'; } if (preg_match('/\.ics$/i', $tmpfile)) { $mime = 'text/calendar'; $imgmime = 'other.png'; $famime = 'file-text-o'; }

View File

@ -37,7 +37,7 @@ $quality = 80;
*/ */
function image_format_supported($file) 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 // Case filename is not a format image
$reg = array(); $reg = array();
@ -46,10 +46,11 @@ function image_format_supported($file)
// Case filename is a format image but not supported by this PHP // Case filename is a format image but not supported by this PHP
$imgfonction = ''; $imgfonction = '';
if (strtolower($reg[1]) == '.gif') $imgfonction = 'imagecreatefromgif'; 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]) == '.jpg') $imgfonction = 'imagecreatefromjpeg';
if (strtolower($reg[1]) == '.jpeg') $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]) == '.bmp') $imgfonction = 'imagecreatefromwbmp';
if (strtolower($reg[1]) == '.webp') $imgfonction = 'imagecreatefromwebp';
if (strtolower($reg[1]) == '.xpm') $imgfonction = 'imagecreatefromxpm'; if (strtolower($reg[1]) == '.xpm') $imgfonction = 'imagecreatefromxpm';
if (strtolower($reg[1]) == '.xbm') $imgfonction = 'imagecreatefromxbm'; if (strtolower($reg[1]) == '.xbm') $imgfonction = 'imagecreatefromxbm';
if (strtolower($reg[1]) == '.svg') $imgfonction = 'imagecreatefromsvg'; // Never available 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 // Fonctions of conversion not available in this PHP
return 0; 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 0;
return 1;
} }
@ -180,6 +183,9 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
case 4: // IMG_WBMP case 4: // IMG_WBMP
$imgfonction = 'imagecreatefromwbmp'; $imgfonction = 'imagecreatefromwbmp';
break; break;
case 17: // IMG_WBMP
$imgfonction = 'imagecreatefromwebp';
break;
} }
if ($imgfonction) if ($imgfonction)
{ {
@ -213,6 +219,11 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
$extImg = '.bmp'; $extImg = '.bmp';
$newquality = 'NU'; // Quality is not used for this format $newquality = 'NU'; // Quality is not used for this format
break; break;
case 18: // Webp
$img = imagecreatefromwebp($filetoread);
$extImg = '.webp';
$newquality = '100'; // % quality maximum
break;
} }
// Create empty image // Create empty image
@ -255,6 +266,9 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
case 4: // Bmp case 4: // Bmp
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0); $trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0);
break; break;
case 18: // Webp
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 127);
break;
} }
if (function_exists("imagefill")) imagefill($imgThumb, 0, 0, $trans_colour); 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 case 4: // Bmp
imagewbmp($imgThumb, $imgThumbName); imagewbmp($imgThumb, $imgThumbName);
break; break;
case 18: // Webp
imagewebp($imgThumb, $imgThumbName, $newquality);
break;
} }
// Set permissions on file // Set permissions on file

View File

@ -205,6 +205,8 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
$tplcontent .= '<?php if ($website->use_manifest) { print \'<link rel="manifest" href="/manifest.json.php" />\'."\n"; } ?>'."\n"; $tplcontent .= '<?php if ($website->use_manifest) { print \'<link rel="manifest" href="/manifest.json.php" />\'."\n"; } ?>'."\n";
$tplcontent .= '<!-- Include link to CSS file -->'."\n"; $tplcontent .= '<!-- Include link to CSS file -->'."\n";
$tplcontent .= '<link rel="stylesheet" href="/styles.css.php?website=<?php echo $websitekey; ?>" type="text/css" />'."\n"; $tplcontent .= '<link rel="stylesheet" href="/styles.css.php?website=<?php echo $websitekey; ?>" type="text/css" />'."\n";
$tplcontent .= '<!-- Include link to JS file -->'."\n";
$tplcontent .= '<script src="/javascript.js.php"></script>'."\n";
$tplcontent .= '<!-- Include HTML header from common file -->'."\n"; $tplcontent .= '<!-- Include HTML header from common file -->'."\n";
$tplcontent .= '<?php print preg_replace(\'/<\/?html>/ims\', \'\', file_get_contents(DOL_DATA_ROOT."/website/".$websitekey."/htmlheader.html")); ?>'."\n"; $tplcontent .= '<?php print preg_replace(\'/<\/?html>/ims\', \'\', file_get_contents(DOL_DATA_ROOT."/website/".$websitekey."/htmlheader.html")); ?>'."\n";
$tplcontent .= '<!-- Include HTML header from page header block -->'."\n"; $tplcontent .= '<!-- Include HTML header from page header block -->'."\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 $filejs Full path of filename to generate
* @param string $jscontent Content of file * @param string $jscontent Content of file

View File

@ -342,26 +342,17 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$num = count($this->lines); $num = count($this->lines);
for ($j = 0; $j < $num; $j++) 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); // Add page break if we do not have space to add current line
$pdf->MultiCell(8, $this->line_height, $j + 1, 0, 'R', 0); if ($lineinpage >= ($this->line_per_page - 1))
$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))
{ {
$lineinpage = 0; $yp = 0; $lineinpage = 0; $yp = 0;
@ -373,6 +364,25 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0, 0, 0); $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);
} }
} }

View File

@ -40,7 +40,7 @@ $cancel = GETPOST('cancel', 'alpha');
$file = GETPOST('file', 'alpha'); $file = GETPOST('file', 'alpha');
$num = GETPOST('num', 'alpha'); // Used for document on bank statement $num = GETPOST('num', 'alpha'); // Used for document on bank statement
$website = GETPOST('website', 'alpha');
// Security check // Security check
if (empty($modulepart)) accessforbidden('Bad value for modulepart'); if (empty($modulepart)) accessforbidden('Bad value for modulepart');
@ -86,8 +86,12 @@ elseif ($modulepart == 'bank')
$result = restrictedArea($user, 'banque', $id, 'bank_account'); $result = restrictedArea($user, 'banque', $id, 'bank_account');
if (!$user->rights->banque->lire) accessforbidden(); if (!$user->rights->banque->lire) accessforbidden();
$accessallowed = 1; $accessallowed = 1;
} } elseif ($modulepart == 'medias')
else // ticket, holiday, expensereport, societe... {
$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); $result = restrictedArea($user, $modulepart, $id, $modulepart);
if (empty($user->rights->$modulepart->read) && empty($user->rights->$modulepart->lire)) accessforbidden(); 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'); if ($result <= 0) dol_print_error($db, 'Failed to load object');
$dir = $conf->$modulepart->dir_output; // By default $dir = $conf->$modulepart->dir_output; // By default
} }
} } elseif ($modulepart == 'mrp') {
elseif ($modulepart == 'mrp')
{
require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php';
$object = new MO($db); $object = new MO($db);
if ($id > 0) if ($id > 0)
@ -235,9 +237,7 @@ elseif ($modulepart == 'mrp')
if ($result <= 0) dol_print_error($db, 'Failed to load object'); if ($result <= 0) dol_print_error($db, 'Failed to load object');
$dir = $conf->$modulepart->dir_output; // By default $dir = $conf->$modulepart->dir_output; // By default
} }
} } elseif ($modulepart == 'bank') {
elseif ($modulepart == 'bank')
{
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$object = new Account($db); $object = new Account($db);
if ($id > 0) if ($id > 0)
@ -246,8 +246,9 @@ elseif ($modulepart == 'bank')
if ($result <= 0) dol_print_error($db, 'Failed to load object'); if ($result <= 0) dol_print_error($db, 'Failed to load object');
$dir = $conf->bank->dir_output; // By default $dir = $conf->bank->dir_output; // By default
} }
} } elseif ($modulepart == 'medias') {
else { $dir = $dolibarr_main_data_root.'/'.$modulepart;
} else {
print 'Action crop for modulepart = '.$modulepart.' is not supported yet by photos_resize.php.'; 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('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('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.'&section_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); 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) 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 // Update/create database for file $fullpath
$rel_filename = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $fullpath); $rel_filename = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $fullpath);
@ -371,7 +381,9 @@ if ($action == 'confirm_crop')
if ($result == $fullpath) if ($result == $fullpath)
{ {
$object->addThumbs($fullpath); if (is_object($object)) {
$object->addThumbs($fullpath);
}
// Update/create database for file $fullpath // Update/create database for file $fullpath
$rel_filename = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $fullpath); $rel_filename = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $fullpath);

View File

@ -56,7 +56,8 @@ foreach ($object->fields as $key => $val)
if (in_array($val['type'], array('int', 'integer'))) $value = GETPOST($key, 'int'); if (in_array($val['type'], array('int', 'integer'))) $value = GETPOST($key, 'int');
elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOST($key, 'none'); elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOST($key, 'none');
else $value = GETPOST($key, 'alpha'); 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 '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }

View File

@ -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_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 -- Delete an old index that is duplicated
-- VMYSQL4.1 DROP INDEX ix_fk_product_stock on llx_product_batch; -- VMYSQL4.1 DROP INDEX ix_fk_product_stock on llx_product_batch;

View File

@ -25,7 +25,7 @@ create table llx_document_model
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
nom varchar(50), nom varchar(50),
entity integer DEFAULT 1 NOT NULL, -- multi company id entity integer DEFAULT 1 NOT NULL, -- multi company id
type varchar(20) NOT NULL, type varchar(64) NOT NULL,
libelle varchar(255), libelle varchar(255),
description text description text
)ENGINE=innodb; )ENGINE=innodb;

View File

@ -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) ValueOverwrittenByUserSetup=Warning, this value may be overwritten by user specific setup (each user can set his own clicktodial url)
ExternalModule=External module ExternalModule=External module
InstalledInto=Installed into directory %s 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 BarcodeInitForProductsOrServices=Mass barcode init or reset for products or services
CurrentlyNWithoutBarCode=Currently, you have <strong>%s</strong> record on <strong>%s</strong> %s without barcode defined. CurrentlyNWithoutBarCode=Currently, you have <strong>%s</strong> record on <strong>%s</strong> %s without barcode defined.
InitEmptyBarCode=Init value for next %s empty records InitEmptyBarCode=Init value for next %s empty records

View File

@ -107,4 +107,6 @@ OrderPrinterToUse=Order printer to use
MainTemplateToUse=Main template to use MainTemplateToUse=Main template to use
OrderTemplateToUse=Order template to use OrderTemplateToUse=Order template to use
BarRestaurant=Bar Restaurant BarRestaurant=Bar Restaurant
AutoOrder=Customer auto order AutoOrder=Customer auto order
RestaurantMenu=Menu
CustomerMenu=Customer menu

View File

@ -840,6 +840,7 @@ Sincerely=Sincerely
ConfirmDeleteObject=Are you sure you want to delete this object? ConfirmDeleteObject=Are you sure you want to delete this object?
DeleteLine=Delete line DeleteLine=Delete line
ConfirmDeleteLine=Are you sure you want to delete this 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 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. TooManyRecordForMassAction=Too many records selected for mass action. The action is restricted to a list of %s records.
NoRecordSelected=No record selected NoRecordSelected=No record selected
@ -1032,4 +1033,4 @@ DeleteFileHeader=Confirm file delete
DeleteFileText=Do you really want delete this file? DeleteFileText=Do you really want delete this file?
ShowOtherLanguages=Show other languages ShowOtherLanguages=Show other languages
SwitchInEditModeToAddTranslation=Switch in edit mode to add translations for this language SwitchInEditModeToAddTranslation=Switch in edit mode to add translations for this language
NotUsedForThisCustomer=Not used for this customer NotUsedForThisCustomer=Not used for this customer

View File

@ -926,6 +926,9 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
dolReplaceInFile($destdir.'/core/modules/mod'.$module.'.class.php', $arrayreplacement, '', 0, 0, 1); 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 // Scan for object class files
$listofobject = dol_dir_list($destdir.'/class', 'files', 0, '\.class\.php$'); $listofobject = dol_dir_list($destdir.'/class', 'files', 0, '\.class\.php$');

View File

@ -257,7 +257,8 @@ $myTmpObjects = array();
$myTmpObjects['MyObject']=array('includerefgeneration'=>0, 'includedocgeneration'=>0); $myTmpObjects['MyObject']=array('includerefgeneration'=>0, 'includedocgeneration'=>0);
foreach($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
if ($myTmpObjectKey == 'MyObject') continue;
if ($myTmpObjectArray['includerefgeneration']) { if ($myTmpObjectArray['includerefgeneration']) {
/* /*
* Orders Numbering model * Orders Numbering model

View File

@ -530,8 +530,8 @@ class MyObject extends CommonObject
return 0; return 0;
} }
/*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->myobject->create)) /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->mymodule->myobject->write))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->myobject->myobject_advance->validate)))) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->mymodule->myobject->myobject_advance->validate))))
{ {
$this->error='NotEnoughPermissions'; $this->error='NotEnoughPermissions';
dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);

View File

@ -407,31 +407,40 @@ class modMyModule extends DolibarrModules
$sql = array(); $sql = array();
// ODT template // Document templates
/* $moduledir = 'mymodule';
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/mymodule/template_myobjects.odt'; $myTmpObjects = array();
$dirodt=DOL_DATA_ROOT.'/doctemplates/mymodule'; $myTmpObjects['MyObject']=array('includerefgeneration'=>0, 'includedocgeneration'=>0);
$dest=$dirodt.'/template_myobjects.odt';
if (file_exists($src) && ! file_exists($dest)) foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
{ if ($myTmpObjectKey == 'MyObject') continue;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; if ($myTmpObjectArray['includerefgeneration']) {
dol_mkdir($dirodt); $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/mymodule/template_myobjects.odt';
$result=dol_copy($src, $dest, 0, 0); $dirodt=DOL_DATA_ROOT.'/doctemplates/mymodule';
if ($result < 0) $dest=$dirodt.'/template_myobjects.odt';
{
$langs->load("errors"); if (file_exists($src) && ! file_exists($dest))
$this->error=$langs->trans('ErrorFailToCopyFile', $src, $dest); {
return 0; 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); return $this->_init($sql, $options);
} }

View File

@ -358,10 +358,10 @@ class pdf_standard_myobject extends ModelePDFMyObject
$pdf->SetDrawColor(128, 128, 128); $pdf->SetDrawColor(128, 128, 128);
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("PdfInvoiceTitle")); $pdf->SetSubject($outputlangs->transnoentities("PdfTitle"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $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); if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
// Set certificate // Set certificate
@ -633,22 +633,6 @@ class pdf_standard_myobject extends ModelePDFMyObject
$pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut $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 // Quantity
// Enough for 6 chars // Enough for 6 chars
if ($this->getColumnStatus('qty')) if ($this->getColumnStatus('qty'))
@ -658,38 +642,6 @@ class pdf_standard_myobject extends ModelePDFMyObject
$nexY = max($pdf->GetY(), $nexY); $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 // Extrafields
if (!empty($object->lines[$i]->array_options)) { if (!empty($object->lines[$i]->array_options)) {
foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) { foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
@ -716,7 +668,6 @@ class pdf_standard_myobject extends ModelePDFMyObject
$sign = 1; $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 // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
$prev_progress = $object->lines[$i]->get_prev_progress($object->id); $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 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->SetFont('', 'B', $default_font_size + 3);
$pdf->SetXY($posx, $posy); $pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60); $pdf->SetTextColor(0, 0, 60);
$title = $outputlangs->transnoentities("PdfInvoiceTitle"); $title = $outputlangs->transnoentities("PdfTitle");
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");
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && is_object($outputlangsbis)) { if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && is_object($outputlangsbis)) {
$title .= ' - '; $title .= ' - ';
if ($object->type == 0) { $title .= $outputlangsbis->transnoentities("PdfTitle");
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");
} }
$pdf->MultiCell($w, 3, $title, '', 'R'); $pdf->MultiCell($w, 3, $title, '', 'R');

View File

@ -51,7 +51,7 @@ abstract class ModelePDFMyObject extends CommonDocGenerator
// phpcs:enable // phpcs:enable
global $conf; global $conf;
$type = 'mymodule_myobject'; $type = 'myobject';
$list = array(); $list = array();
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';

View File

@ -569,8 +569,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$filedir = $conf->mymodule->dir_output.'/'.$object->element.'/'.$objref; $filedir = $conf->mymodule->dir_output.'/'.$object->element.'/'.$objref;
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; $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 $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 $delallowed = $user->rights->mymodule->myobject->write; // 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); 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 // Show links to link elements

View File

@ -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') 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); dol_syslog(get_class($this)."::selectWarehouses $selected, $htmlname, $filterstatus, $empty, $disabled, $fk_product, $empty_label, $showstock, $forcecombo, $morecss", LOG_DEBUG);
$out = ''; $out = '';
if (empty($conf->global->ENTREPOT_EXTRA_STATUS)) $filterstatus = ''; if (empty($conf->global->ENTREPOT_EXTRA_STATUS)) $filterstatus = '';
if (!empty($fk_product)) $this->cache_warehouses = array(); if (!empty($fk_product)) $this->cache_warehouses = array();
$this->loadWarehouses($fk_product, '', $filterstatus, true, $exclude, $stockMin, $orderBy); $this->loadWarehouses($fk_product, '', $filterstatus, true, $exclude, $stockMin, $orderBy);
$nbofwarehouses = count($this->cache_warehouses); $nbofwarehouses = count($this->cache_warehouses);
@ -287,6 +288,28 @@ class FormProduct
$out .= '</select>'; $out .= '</select>';
if ($disabled) $out .= '<input type="hidden" name="'.$htmlname.'" value="'.(($selected > 0) ? $selected : '').'">'; if ($disabled) $out .= '<input type="hidden" name="'.$htmlname.'" value="'.(($selected > 0) ? $selected : '').'">';
$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; return $out;
} }

View File

@ -79,7 +79,7 @@ class Product extends CommonObject
*/ */
protected $table_ref_field = 'ref'; 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 * @deprecated

View File

@ -52,9 +52,7 @@ if (GETPOST('action', 'alpha') == 'set')
{ {
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else
{
$db->rollback(); $db->rollback();
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
@ -129,11 +127,17 @@ if ($conf->global->TAKEPOS_SUPPLEMENTS)
} }
print '<tr class="oddeven value"><td>'; print '<tr class="oddeven value"><td>';
print $langs->trans("AutoOrder"); print 'QR - '.$langs->trans("AutoOrder");
print '<td colspan="2">'; print '<td colspan="2">';
print ajax_constantonoff("TAKEPOS_AUTO_ORDER", array(), $conf->entity, 0, 0, 1, 0); print ajax_constantonoff("TAKEPOS_AUTO_ORDER", array(), $conf->entity, 0, 0, 1, 0);
print '</td></tr>'; print '</td></tr>';
print '<tr class="oddeven value"><td>';
print 'QR - '.$langs->trans("CustomerMenu");
print '<td colspan="2">';
print ajax_constantonoff("TAKEPOS_QR_MENU", array(), $conf->entity, 0, 0, 1, 0);
print '</td></tr>';
print '</table>'; print '</table>';
@ -157,13 +161,30 @@ if ($conf->global->TAKEPOS_AUTO_ORDER)
print '<td>'; print '<td>';
print "<a target='_blank' href='".$urlwithroot."/takepos/public/auto_order.php?key=".dol_encode($row['rowid'])."'>".$urlwithroot."/takepos/public/auto_order.php?key=".dol_encode($row['rowid'])."</a>"; print "<a target='_blank' href='".$urlwithroot."/takepos/public/auto_order.php?key=".dol_encode($row['rowid'])."'>".$urlwithroot."/takepos/public/auto_order.php?key=".dol_encode($row['rowid'])."</a>";
print '<td>'; print '<td>';
print "<img src='".DOL_URL_ROOT."/takepos/genimg/qr.php?id=".dol_encode($row['rowid'])."' height='42' width='42'>"; print "<img src='".DOL_URL_ROOT."/takepos/genimg/qr.php?key=".dol_encode($row['rowid'])."' height='42' width='42'>";
print '</td></tr>'; print '</td></tr>';
} }
print '</table>'; print '</table>';
} }
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 '<br>';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("URL").'</td><td>'.$langs->trans("QR").'</td>';
print "</tr>\n";
print '<tr class="oddeven value"><td>';
print "<a target='_blank' href='".$urlwithroot."/takepos/public/menu.php'>".$urlwithroot."/takepos/public/menu.php</a>";
print '<td>';
print "<img src='".DOL_URL_ROOT."/takepos/genimg/qr.php' height='42' width='42'>";
print '</td></tr>';
print '</table>';
}
print '</div>'; print '</div>';
print '<br>'; print '<br>';

View File

@ -27,10 +27,15 @@ if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
require '../../main.inc.php'; // Load $user and permissions require '../../main.inc.php'; // Load $user and permissions
require '../../core/modules/barcode/doc/tcpdfbarcode.modules.php'; require '../../core/modules/barcode/doc/tcpdfbarcode.modules.php';
$key = GETPOST('key');
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); $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 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
$module = new modTcpdfbarcode(); if (GETPOSTISSET("key")) {
$result = $module->buildBarCode($urlwithroot."/takepos/public/auto_order.php?key=".dol_encode($key), 'QRCODE', 'Y'); $key = GETPOST('key');
$module = new modTcpdfbarcode();
$result = $module->buildBarCode($urlwithroot."/takepos/public/auto_order.php?key=".$key, 'QRCODE', 'Y');
}
else {
$module = new modTcpdfbarcode();
$result = $module->buildBarCode($urlwithroot."/takepos/public/menu.php", 'QRCODE', 'Y');
}

View File

@ -0,0 +1,144 @@
/* -- footer -- */
html {
position: relative;
min-height: 100%;
}
body {
margin-bottom: 60px;
font-family: 'Khand', sans-serif;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
height: 60px;
background-color: #f5f5f5;
}
.container .text-muted {
margin: 20px 0;
}
.footer > .container {
padding-right: 15px;
padding-left: 15px;
}
/* -- -- */
h3 {
display:inline-block;
font-size: 32px;
line-height: 36px;
position: relative;
margin-top:28px;
margin-bottom:15px;
}
h3:before{
left: -40px;
height: 0;
height:1px;
}
h3:before, h3:after {
content: "";
position: absolute;
bottom: 10px;
height: 1px;
width: 40px;
margin: 0 -15px;
background-color: #533834;
}
h3:after{
right: -40px;
}
h5 {
font-size: 16px;
line-height: 22px;
margin: 0 0 15px;
font-weight: 400;
}
.item {
position: relative;
overflow: hidden;
margin-bottom:20px;
}
.item h4, .price {
z-index: 0;
position: relative;
background-color: #fff;
right: 0;
position: absolute;
}
.item .price {
padding-left: 8px;
}
.item h4, .item p {
display: block;
clear: both;
color: #533834;
}
.item p {
clear: both;
color: #938372;
margin-left:10px;
}
.dots {
background-image: linear-gradient(to right,rgba(56,47,47,.5) 33%,rgba(0,0,0,0) 0%);
background-position: bottom;
background-size: 3px 1px;
background-repeat: repeat-x;
height: 1px;
width: 100%;
position: absolute;
top: 22px;
}
/* Dots in IE */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
.dots {
background: transparent url('/img/dot.gif') repeat-x bottom left;
}
}
.badge {
display: inline-block;
padding: 0 10px;
background: #d2c82a;
font-size: 12px;
font-weight: 300;
line-height: 26px;
color: #fff;
text-align: center;
vertical-align: middle;
text-transform: uppercase;
border: 1px solid rgba(0,0,0,.05);
letter-spacing: 1px;
border-radius: 3px;
margin: -5px 5px 0 0;
}
.note {
padding: 0 6px;
min-width: 23px;
background: rgba(0,0,0,0);
border: 1px solid #382f2f;
color: #382f2f;
box-sizing: border-box;
border-radius: 500px;
line-height: 21px;
}
.veggie {
color:#82b440;
border-color:#82b440;
}
.spicy {
color:#ec4e00;
border-color:#ec4e00;
}
.price {
position: absolute;
font-size:22px;
font-weight:400;
right: 0;
}
.item h4 {
display: inline-block;
padding-right: 8px;
max-width: 80%;
text-transform: capitalize;
margin-bottom:4px;
position: relative;
}

View File

@ -0,0 +1 @@
$(document).foundation();

View File

@ -0,0 +1,117 @@
<?php
/* Copyright (C) - 2020 Andreu Bisquerra Gaya <jove@bisquerra.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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/takepos/public/menu.php
* \ingroup takepos
* \brief Public menu for customers
*/
if (!defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
if (!$conf->global->TAKEPOS_QR_MENU) accessforbidden(); // If Restaurant Menu is disabled never allow NO LOGIN access
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><?php echo $mysoc->name; ?></title>
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/foundation-sites@6.6.3/dist/css/foundation.min.css'>
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Khand:400,300,500,600,700'><link rel="stylesheet" href="css/style.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<!-- partial:index.partial.html -->
<body>
<div class="grid-container">
<div class="grid-x grid-padding-x menu2">
<div class="cell small-12">
<h1><?php print $mysoc->name; ?> <small><?php print $langs->trans('RestaurantMenu'); ?></small></h1>
<?php
$categorie = new Categorie($db);
$categories = $categorie->get_full_arbo('product', (($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0) ? $conf->global->TAKEPOS_ROOT_CATEGORY_ID : 0), 1);
$levelofrootcategory = 0;
if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0)
{
foreach ($categories as $key => $categorycursor)
{
if ($categorycursor['id'] == $conf->global->TAKEPOS_ROOT_CATEGORY_ID)
{
$levelofrootcategory = $categorycursor['level'];
break;
}
}
}
$levelofmaincategories = $levelofrootcategory + 1;
$maincategories = array();
$subcategories = array();
foreach ($categories as $key => $categorycursor)
{
if ($categorycursor['level'] == $levelofmaincategories)
{
$maincategories[$key] = $categorycursor;
} else {
$subcategories[$key] = $categorycursor;
}
}
$maincategories = dol_sort_array($maincategories, 'label');
foreach ($maincategories as $cat){
print '<div class="text-center">
<a id="'.$cat['id'].'"></a><h3>'.$cat['label'].'</h3>
</div>
<div class="grid-x grid-padding-x">';
$object = new Categorie($db);
$result = $object->fetch($cat['id']);
$prods = $object->getObjectsInCateg("product", 0, 0, 0, $conf->global->TAKEPOS_SORTPRODUCTFIELD, 'ASC');
foreach ($prods as $pro){
print '
<div class="cell small-6 medium-4">
<div class="item">
<h4>'.$pro->label.'</h4>
<span class="dots"></span>
<span class="price">'.price($pro->price_ttc, 1).'</span>
</div>
</div>';
}
print '</div>';
}
?>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="text-muted"><?php print $mysoc->name; ?></p>
</div>
</footer>
</body>
<!-- partial -->
<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js'></script>
<script src='https://cdn.jsdelivr.net/npm/foundation-sites@6.6.3/dist/js/foundation.min.js'></script><script src="js/script.js"></script>
</body>
</html>

View File

@ -667,10 +667,12 @@ body[class*="colorblind-"] .text-success{
color : <?php print $textDanger; ?> color : <?php print $textDanger; ?>
} }
.editfielda span.fa-pencil-alt, .editfielda span.fa-trash, .editfieldlang { .editfielda span.fa-pencil-alt, .editfielda span.fa-pencil-ruler, .editfielda span.fa-trash, .editfielda span.fa-crop,
.editfieldlang {
color: #ccc !important; color: #ccc !important;
} }
.editfielda span.fa-pencil-alt:hover, .editfielda span.fa-trash:hover, .editfieldlang:hover { .editfielda span.fa-pencil-alt:hover, .editfielda span.fa-pencil-ruler:hover, .editfielda span.fa-trash:hover, .editfielda span.fa-crop:hover,
.editfieldlang:hover {
color: var(--colortexttitle) !important; color: var(--colortexttitle) !important;
} }
.fawidth30 { .fawidth30 {
@ -3989,15 +3991,20 @@ div.titre {
padding-top: 5px; padding-top: 5px;
padding-bottom: 5px; padding-bottom: 5px;
} }
.secondary, div.titre { div.fiche > table.table-fiche-title:first-of-type div {
color: var(--colortexttitlenotab);
/* font-weight: 600; */
}
div.titre {
color: var(--colortexttitlenotab);
}
.secondary {
color: var(--colortexttitlenotab); color: var(--colortexttitlenotab);
} }
.tertiary { .tertiary {
color: var(--colortexttitlenotab2); color: var(--colortexttitlenotab2);
} }
table.table-fiche-title:first-of-type div {
color: var(--colortexttitlenotab);
}
table.table-fiche-title .col-title div.titre{ table.table-fiche-title .col-title div.titre{
line-height: 40px; line-height: 40px;

View File

@ -67,8 +67,8 @@ $colorbacklinepairhover = '230,237,244'; // line hover
$colorbacklinepairchecked = '230,237,244'; // line checked $colorbacklinepairchecked = '230,237,244'; // line checked
$colorbacklinebreak = '248,247,244'; // line break $colorbacklinebreak = '248,247,244'; // line break
$colorbackbody = '255,255,255'; $colorbackbody = '255,255,255';
$colortexttitlenotab = '0,123,140'; // 150,90,121 140,80,10 or 10,140,80 #875a7b green=0,113,120, violet: 0,50,120 $colortexttitlenotab = '0,123,140'; // 150,90,121 140,80,10 or 10,140,80 #875a7b green=0,123,140, violet: 0,50,120
$colortexttitlenotab2 = '100,0,100'; // 150,90,121 140,80,10 or 10,140,80 #875a7b green=0,113,120, violet: 0,50,120 $colortexttitlenotab2 = '100,0,100'; // 150,90,121 140,80,10 or 10,140,80 #875a7b green=0,123,140, violet: 0,50,120
$colortexttitle = '0,0,0'; $colortexttitle = '0,0,0';
$colortexttitlelink = '10, 20, 100'; $colortexttitlelink = '10, 20, 100';
$colortext = '0,0,0'; $colortext = '0,0,0';

View File

@ -285,6 +285,8 @@ if ($action == 'replacesiteconfirm') {
$listofpages = getPagesFromSearchCriterias('', $algo, $searchkey, 1000, $sortfield, $sortorder); $listofpages = getPagesFromSearchCriterias('', $algo, $searchkey, 1000, $sortfield, $sortorder);
} }
$usercanedit = $user->rights->website->write;
$permissiontodelete = $user->rights->website->delete;
/* /*
@ -319,6 +321,10 @@ if (GETPOST('refreshsite', 'alpha') || GETPOST('refreshsite.x', 'alpha') || GETP
} }
if (GETPOST('refreshpage', 'alpha') && !in_array($action, array('updatecss'))) $action = 'preview'; if (GETPOST('refreshpage', 'alpha') && !in_array($action, array('updatecss'))) $action = 'preview';
if ($cancel && $action == 'renamefile') {
$cancel = '';
}
// Cancel // Cancel
if ($cancel) if ($cancel)
{ {
@ -337,7 +343,9 @@ if ($sortorder) $backtopage .= '&sortorder='.$sortorder;
include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
$backtopage = $savbacktopage; $backtopage = $savbacktopage;
if ($action == 'renamefile') $action = 'file_manager'; // After actions_linkedfiles, if action were renamefile, we set it to 'file_manager' if ($action == 'renamefile') { // Must be after include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; If action were renamefile, we set it to 'file_manager'
$action = 'file_manager';
}
if ($action == 'seteditinline') if ($action == 'seteditinline')
{ {
@ -367,9 +375,10 @@ if ($action == 'unsetshowsubcontainers')
exit; exit;
} }
if (($action == 'replacesite' || $action == 'replacesiteconfirm') && !$searchkey) if ($massaction == 'replace' && GETPOST('confirmmassaction', 'alpha') && !$searchkey)
{ {
$action = 'replacesite'; $action = 'replacesite';
$massaction = '';
} }
// Replacement of string into pages // Replacement of string into pages
@ -1105,9 +1114,8 @@ if ($action == 'confirm_deletesite' && $confirm == 'yes')
} }
} }
// Delete page // Delete page (from website page menu)
if ($action == 'delete') if (GETPOSTISSET('pageid') && $action == 'delete' && $permissiontodelete) {
{
$error = 0; $error = 0;
$db->begin(); $db->begin();
@ -1141,6 +1149,62 @@ if ($action == 'delete')
dol_print_error($db); dol_print_error($db);
} }
} }
// Delete page (from menu search)
if (! GETPOSTISSET('pageid')) {
$objectclass = 'WebsitePage';
// Add part of code from actions_massactions.inc.php
// Delete record from mass action (massaction = 'delete' for direct delete, action/confirm='delete'/'yes' with a confirmation step before)
if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == 'yes')) && $permissiontodelete)
{
$db->begin();
$objecttmp = new $objectclass($db);
$nbok = 0;
foreach ($toselect as $toselectid)
{
$result = $objecttmp->fetch($toselectid);
if ($result > 0)
{
$result = $objecttmp->delete($user);
if ($result <= 0)
{
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++;
break;
} else $nbok++;
} else {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++;
break;
}
}
if (!$error)
{
if ($nbok > 1) setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs');
else setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs');
$db->commit();
} else {
$db->rollback();
}
//var_dump($listofobjectthirdparties);exit;
}
if ($action == 'delete') {
$action = 'replacesiteconfirm';
$containertype = GETPOST('optioncontainertype', 'aZ09') != '-1' ? GETPOST('optioncontainertype', 'aZ09') : '';
$langcode = GETPOST('optionlanguage', 'aZ09');
$otherfilters = array();
if (GETPOST('optioncategory', 'int') > 0) {
$otherfilters['category'] = GETPOST('optioncategory', 'int');
}
$listofpages = getPagesFromSearchCriterias($containertype, $algo, $searchkey, 1000, $sortfield, $sortorder, $langcode, $otherfilters);
}
}
// Update css Update site properties // Update css Update site properties
if ($action == 'updatecss') if ($action == 'updatecss')
@ -2360,8 +2424,7 @@ if (!GETPOST('hide_websitemenu'))
// Toolbar for pages // Toolbar for pages
if ($websitekey && $websitekey != '-1' && !in_array($action, array('editcss', 'editmenu', 'importsite', 'file_manager', 'replacesite', 'replacesiteconfirm')) && !$file_manager)
if ($websitekey && $websitekey != '-1' && !in_array($action, array('editcss', 'editmenu', 'importsite')))
{ {
print '</div>'; // Close current websitebar to open a new one print '</div>'; // Close current websitebar to open a new one
@ -2915,7 +2978,10 @@ if ($action == 'editcss')
// JS file // JS file
print '<tr><td class="tdtop">'; print '<tr><td class="tdtop">';
print $langs->trans('WEBSITE_JS_INLINE'); $textwithhelp = $langs->trans('WEBSITE_JS_INLINE');
$htmlhelp2 = $langs->trans("LinkAndScriptsHereAreNotLoadedInEditor").'<br>';
print $form->textwithpicto($textwithhelp, $htmlhelp2, 1, 'warning', '', 0, 2, 'htmljstooltip2');
print '</td><td>'; print '</td><td>';
$doleditor = new DolEditor('WEBSITE_JS_INLINE', $jscontent, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', ''); $doleditor = new DolEditor('WEBSITE_JS_INLINE', $jscontent, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', '');
@ -3210,6 +3276,7 @@ if ($action == 'editmeta' || $action == 'createcontainer')
$pageauthorid = $objectpage->fk_user_creat; $pageauthorid = $objectpage->fk_user_creat;
$pageusermodifid = $objectpage->fk_user_modif; $pageusermodifid = $objectpage->fk_user_modif;
$pageauthoralias = $objectpage->author_alias; $pageauthoralias = $objectpage->author_alias;
$pagestatus = $objectpage->status;
} }
else else
{ {
@ -3218,6 +3285,7 @@ if ($action == 'editmeta' || $action == 'createcontainer')
$pageauthorid = $user->id; $pageauthorid = $user->id;
$pageusermodifid = 0; $pageusermodifid = 0;
$pageauthoralias = ''; $pageauthoralias = '';
$pagestatus = 1;
} }
if (GETPOST('WEBSITE_TITLE', 'alpha')) $pagetitle = GETPOST('WEBSITE_TITLE', 'alpha'); if (GETPOST('WEBSITE_TITLE', 'alpha')) $pagetitle = GETPOST('WEBSITE_TITLE', 'alpha');
if (GETPOST('WEBSITE_PAGENAME', 'alpha')) $pageurl = GETPOST('WEBSITE_PAGENAME', 'alpha'); if (GETPOST('WEBSITE_PAGENAME', 'alpha')) $pageurl = GETPOST('WEBSITE_PAGENAME', 'alpha');
@ -3228,20 +3296,6 @@ if ($action == 'editmeta' || $action == 'createcontainer')
if (GETPOST('WEBSITE_LANG', 'aZ09')) $pagelang = GETPOST('WEBSITE_LANG', 'aZ09'); if (GETPOST('WEBSITE_LANG', 'aZ09')) $pagelang = GETPOST('WEBSITE_LANG', 'aZ09');
if (GETPOST('htmlheader', 'none')) $pagehtmlheader = GETPOST('htmlheader', 'none'); if (GETPOST('htmlheader', 'none')) $pagehtmlheader = GETPOST('htmlheader', 'none');
// Title
print '<tr><td class="fieldrequired">';
print $langs->trans('WEBSITE_TITLE');
print '</td><td>';
print '<input type="text" class="flat quatrevingtpercent" name="WEBSITE_TITLE" id="WEBSITE_TITLE" value="'.dol_escape_htmltag($pagetitle).'" autofocus>';
print '</td></tr>';
// Alias
print '<tr><td class="titlefieldcreate fieldrequired">';
print $langs->trans('WEBSITE_PAGENAME');
print '</td><td>';
print '<input type="text" class="flat minwidth300" name="WEBSITE_PAGENAME" id="WEBSITE_PAGENAME" value="'.dol_escape_htmltag($pageurl).'">';
print '</td></tr>';
// Type of container // Type of container
print '<tr><td class="titlefield fieldrequired">'; print '<tr><td class="titlefield fieldrequired">';
print $langs->trans('WEBSITE_TYPE_CONTAINER'); print $langs->trans('WEBSITE_TYPE_CONTAINER');
@ -3258,6 +3312,20 @@ if ($action == 'editmeta' || $action == 'createcontainer')
print '</td></tr>'; print '</td></tr>';
} }
// Title
print '<tr><td class="fieldrequired">';
print $langs->trans('WEBSITE_TITLE');
print '</td><td>';
print '<input type="text" class="flat quatrevingtpercent" name="WEBSITE_TITLE" id="WEBSITE_TITLE" value="'.dol_escape_htmltag($pagetitle).'" autofocus>';
print '</td></tr>';
// Alias
print '<tr><td class="titlefieldcreate fieldrequired">';
print $langs->trans('WEBSITE_PAGENAME');
print '</td><td>';
print '<input type="text" class="flat minwidth300" name="WEBSITE_PAGENAME" id="WEBSITE_PAGENAME" value="'.dol_escape_htmltag($pageurl).'">';
print '</td></tr>';
print '<tr><td>'; print '<tr><td>';
print $langs->trans('WEBSITE_DESCRIPTION'); print $langs->trans('WEBSITE_DESCRIPTION');
print '</td><td>'; print '</td><td>';
@ -3548,7 +3616,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction =
print '<input type="hidden" name="website" value="'.$website->ref.'">'; print '<input type="hidden" name="website" value="'.$website->ref.'">';
print '<!-- Replace string -->'."\n"; print '<!-- Search page and replace string -->'."\n";
print '<div class="fiche"><br>'; print '<div class="fiche"><br>';
print load_fiche_titre($langs->trans("ReplaceWebsiteContent"), '', 'search'); print load_fiche_titre($langs->trans("ReplaceWebsiteContent"), '', 'search');
@ -3556,7 +3624,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction =
print '<div class="tagtable">'; print '<div class="tagtable">';
print '<div class="tagtr">'; print '<div class="tagtr">';
print '<div class="tagtd paddingrightonly">'; print '<div class="tagtd paddingrightonly opacitymedium">';
print $langs->trans("SearchReplaceInto"); print $langs->trans("SearchReplaceInto");
print '</div>'; print '</div>';
print '<div class="tagtd">'; print '<div class="tagtd">';
@ -3593,15 +3661,15 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction =
$param = ''; $param = '';
$nbtotalofrecords = count($listofpages['list']); $nbtotalofrecords = count($listofpages['list']);
$num = $limit; $num = $limit;
$permissiontodelete = 0; $permissiontodelete = $user->rights->website->delete;
// List of mass actions available // List of mass actions available
$arrayofmassactions = array(); $arrayofmassactions = array();
if ($user->rights->website->writephp) $arrayofmassactions['replace'] = $langs->trans("Replace"); if ($user->rights->website->writephp && $searchkey) $arrayofmassactions['replace'] = $langs->trans("Replace");
if ($permissiontodelete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete"); //if ($permissiontodelete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
$massactionbutton = $form->selectMassAction('', $arrayofmassactions); $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
$massactionbutton .= '<div class="massactionother hidden">'; $massactionbutton .= '<div class="massactionother massactionreplace hidden">';
$massactionbutton .= $langs->trans("ReplaceString"); $massactionbutton .= $langs->trans("ReplaceString");
$massactionbutton .= '<input type="text" name="replacestring" value="'.dol_escape_htmltag(GETPOST('replacestring', 'none')).'">'; $massactionbutton .= '<input type="text" name="replacestring" value="'.dol_escape_htmltag(GETPOST('replacestring', 'none')).'">';
$massactionbutton .= '</div>'; $massactionbutton .= '</div>';
@ -3610,11 +3678,17 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction =
//$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields //$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1); $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit, 1, 1, 1); print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, '', '', $limit, 1, 1, 1);
print '<!-- List of search result -->'."\n"; print '<!-- List of search result -->'."\n";
print '<div class="rowsearchresult">'; print '<div class="rowsearchresult">';
$topicmail = "WebsitePageRef";
$modelmail = "websitepage_send";
$objecttmp = new WebsitePage($db);
$trackid = 'wsp'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
$param = 'action=replacesiteconfirm&website='.urlencode($website->ref); $param = 'action=replacesiteconfirm&website='.urlencode($website->ref);
$param .= '&searchstring='.urlencode($searchkey); $param .= '&searchstring='.urlencode($searchkey);
if (GETPOST('optioncontent')) $param .= '&optioncontent=content'; if (GETPOST('optioncontent')) $param .= '&optioncontent=content';