From a33f503a0d45d17d19dddbeb3f8d25d9e8a4f93d Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 31 May 2020 14:28:41 +0200 Subject: [PATCH 01/11] FIX php error Fatal error: Uncaught Error: Call to undefined function getCountry() in /volume2/web/dolibarr/htdocs/core/class/html.form.class.php on line 2583 Error: Call to undefined function getCountry() in /volume2/web/dolibarr/htdocs/core/class/html.form.class.php on line 2583 Call Stack: 0.0001 409544 1. {main}() /volume2/web/dolibarr/htdocs/adherents/admin/adherent.php:0 0.1935 3017200 2. Form->select_produits() /volume2/web/dolibarr/htdocs/adherents/admin/adherent.php:215 0.1935 3017200 3. Form->select_produits_list() /volume2/web/dolibarr/htdocs/core/class/html.form.class.php:2134 0.1983 3439880 4. Form->constructProductListOption() /volume2/web/dolibarr/htdocs/core/class/html.form.class.php:2451 --- htdocs/core/class/html.form.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 7496de72ec2..5d7e008e062 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2523,6 +2523,8 @@ class Form $outdurationvalue = $outtype == Product::TYPE_SERVICE ?substr($objp->duration, 0, dol_strlen($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 $outvalUnits = ''; if (!empty($conf->global->PRODUCT_USE_UNITS)) { From c4d8f0b6cc2eaba6c152ce964c67972670cb7408 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Jun 2020 12:35:27 +0200 Subject: [PATCH 02/11] css --- htdocs/theme/eldy/info-box.inc.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index badc7f2d655..604aff91a3e 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -188,8 +188,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> .info-box-title{ text-transform: uppercase; font-weight: bold; - margin-bottom: 6px; - /* padding-bottom: 4px; */ + margin-bottom: 3px; /* not too much space so we can add another lines */ } .info-box-text{ font-size: 0.92em; From 38001a4e89f19acd3f8f0f6514709a90a8e84224 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Jun 2020 14:52:26 +0200 Subject: [PATCH 03/11] Fix perms --- htdocs/modulebuilder/template/class/myobject.class.php | 4 ++-- htdocs/modulebuilder/template/myobject_card.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 07850c17491..41a679b6292 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -569,7 +569,7 @@ 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 + $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); } From 2324834b73936629feb73fe22f930c2fb986f8fd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Jun 2020 16:44:22 +0200 Subject: [PATCH 04/11] Debug modulebuilder for doc generation Conflicts: htdocs/core/class/html.formfile.class.php htdocs/modulebuilder/template/admin/setup.php --- htdocs/core/class/html.formfile.class.php | 12 ++-- .../install/mysql/migration/11.0.0-12.0.0.sql | 2 + .../mysql/tables/llx_document_model.sql | 2 +- htdocs/modulebuilder/index.php | 5 +- htdocs/modulebuilder/template/admin/setup.php | 3 +- .../core/modules/modMyModule.class.php | 51 ++++++++------ .../doc/pdf_standard_myobject.modules.php | 68 ++----------------- .../modules/mymodule/modules_myobject.php | 2 +- .../modulebuilder/template/myobject_card.php | 2 +- 9 files changed, 51 insertions(+), 96 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 32deb0667e8..0da4b2ca390 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)) { 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/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 2a01a282a90..89a1d20628e 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$'); @@ -1057,7 +1060,7 @@ if ($dirins && ($action == 'droptable' || $action == 'droptableextrafields') && $objectname = $tabobj; $arrayoftables = array(); - if ($action == 'droptable') $arrayoftables[] = MAIN_DB_PREFIX.strtolower($module).'_'.strtolower($tabobj); + if ($action == 'droptable') $arrayoftables[] = MAIN_DB_PREFIX.strtoslower($module).'_'.strtolower($tabobj); if ($action == 'droptableextrafields') $arrayoftables[] = MAIN_DB_PREFIX.strtolower($module).'_'.strtolower($tabobj).'_extrafields'; foreach ($arrayoftables as $tabletodrop) 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/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 41a679b6292..ceeb30d5d3e 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -570,7 +570,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $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->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 From c60982ce609688d4dcd6f02a410ce88455656e57 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Mon, 1 Jun 2020 16:58:05 +0200 Subject: [PATCH 05/11] Update langs --- htdocs/langs/en_US/cashdesk.lang | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 From 5325971517d62bc15e5e93a178ce4862b3e7ae6b Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Mon, 1 Jun 2020 17:02:11 +0200 Subject: [PATCH 06/11] Update settings --- htdocs/takepos/admin/bar.php | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) 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 ''; + print "\n"; + print ''; + print '
'.$langs->trans("URL").''.$langs->trans("QR").'
'; + print "".$urlwithroot."/takepos/public/menu.php"; + print ''; + print ""; + print '
'; +} + print ''; print '
'; From 3cc249a887538f4acc013aa369f7252a2c453651 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Mon, 1 Jun 2020 17:04:23 +0200 Subject: [PATCH 07/11] Update QR --- htdocs/takepos/genimg/qr.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/takepos/genimg/qr.php b/htdocs/takepos/genimg/qr.php index 3aca3b22ebf..452eb7023e2 100644 --- a/htdocs/takepos/genimg/qr.php +++ b/htdocs/takepos/genimg/qr.php @@ -27,10 +27,15 @@ if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); require '../../main.inc.php'; // Load $user and permissions 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)); $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file -$module = new modTcpdfbarcode(); -$result = $module->buildBarCode($urlwithroot."/takepos/public/auto_order.php?key=".dol_encode($key), 'QRCODE', 'Y'); +if (GETPOSTISSET("key")) { + $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'); +} From 8abe60db0b821ff7faa50aa9580c36830893ccb3 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Mon, 1 Jun 2020 17:05:22 +0200 Subject: [PATCH 08/11] Add Restaurant QR menu --- htdocs/takepos/public/css/style.css | 144 ++++++++++++++++++++++++++++ htdocs/takepos/public/js/script.js | 1 + htdocs/takepos/public/menu.php | 117 ++++++++++++++++++++++ 3 files changed, 262 insertions(+) create mode 100644 htdocs/takepos/public/css/style.css create mode 100644 htdocs/takepos/public/js/script.js create mode 100644 htdocs/takepos/public/menu.php diff --git a/htdocs/takepos/public/css/style.css b/htdocs/takepos/public/css/style.css new file mode 100644 index 00000000000..418945cf5f5 --- /dev/null +++ b/htdocs/takepos/public/css/style.css @@ -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; +} \ No newline at end of file diff --git a/htdocs/takepos/public/js/script.js b/htdocs/takepos/public/js/script.js new file mode 100644 index 00000000000..c3c8817354f --- /dev/null +++ b/htdocs/takepos/public/js/script.js @@ -0,0 +1 @@ +$(document).foundation(); \ No newline at end of file diff --git a/htdocs/takepos/public/menu.php b/htdocs/takepos/public/menu.php new file mode 100644 index 00000000000..c15df6d1b9c --- /dev/null +++ b/htdocs/takepos/public/menu.php @@ -0,0 +1,117 @@ + + * + * 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 . + */ + +/** + * \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 +?> + + + + + <?php echo $mysoc->name; ?> + + + + + + + +
+ +
+
+
+

name; ?>

+
+
+ + + + + + + From b0f904508afb1b1864c1196a87e9b9487fdfc796 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Mon, 1 Jun 2020 17:52:38 +0200 Subject: [PATCH 09/11] Fix travis --- htdocs/takepos/public/menu.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/takepos/public/menu.php b/htdocs/takepos/public/menu.php index c15df6d1b9c..c051ae4d673 100644 --- a/htdocs/takepos/public/menu.php +++ b/htdocs/takepos/public/menu.php @@ -83,7 +83,7 @@ foreach ($maincategories as $cat){

'.$cat['label'].'

'; - + $object = new Categorie($db); $result = $object->fetch($cat['id']); $prods = $object->getObjectsInCateg("product", 0, 0, 0, $conf->global->TAKEPOS_SORTPRODUCTFIELD, 'ASC'); @@ -93,12 +93,12 @@ foreach ($maincategories as $cat){

'.$pro->label.'

- '.price($pro->price_ttc,1).' + '.price($pro->price_ttc, 1).'
'; } print ''; -} +} ?> From 7189e060e02908243cfc31ca64ff8cfca541579d Mon Sep 17 00:00:00 2001 From: "DEMAREST Maxime (Indelog)" Date: Tue, 2 Jun 2020 11:17:37 +0200 Subject: [PATCH 10/11] Fix line heiht overflow for blochet template Fixed if by adding dynamic line height calculation. Now line height depend on bank field content or transmitter field content. You can use long text in this fields. --- .../modules/cheque/doc/pdf_blochet.class.php | 48 +++++++++++-------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php index 57a94baae9f..b31b9c25a4b 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]->bank_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); } } From c6a53d9b3d65aa14ff8373fe8d32c038ec82c23b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Jun 2020 12:09:11 +0200 Subject: [PATCH 11/11] Update pdf_blochet.class.php --- htdocs/core/modules/cheque/doc/pdf_blochet.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php index b31b9c25a4b..ec6f52dfec7 100644 --- a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php @@ -345,7 +345,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts // 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]->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;