From 830a117aa7ae799cd93021b68408aa177b733cc4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 May 2020 23:39:03 +0200 Subject: [PATCH] Suggest fix for #13824 --- htdocs/bom/class/bom.class.php | 5 ++++- htdocs/takepos/admin/bar.php | 2 +- htdocs/takepos/admin/setup.php | 2 +- htdocs/takepos/genimg/qr.php | 2 +- htdocs/takepos/phone.php | 8 ++++---- htdocs/takepos/public/auto_order.php | 6 +++++- 6 files changed, 16 insertions(+), 9 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index c2c18dae6e5..3e522b3c11f 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1004,6 +1004,7 @@ class BOM extends CommonObject /** * BOM costs calculation based on cost_price or pmp of each BOM line + * * @return void */ public function calculateCosts() @@ -1022,7 +1023,9 @@ class BOM extends CommonObject } $this->total_cost = price2num($this->total_cost, 'MT'); - $this->unit_cost = price2num($this->total_cost / $this->qty, 'MU'); + if ($this->qty) { + $this->unit_cost = price2num($this->total_cost / $this->qty, 'MU'); + } } } diff --git a/htdocs/takepos/admin/bar.php b/htdocs/takepos/admin/bar.php index 7b6e1d9a98c..5c255dc89c7 100644 --- a/htdocs/takepos/admin/bar.php +++ b/htdocs/takepos/admin/bar.php @@ -157,7 +157,7 @@ if ($conf->global->TAKEPOS_AUTO_ORDER) print ''; print "".$urlwithroot."/takepos/public/auto_order.php?key=".dol_encode($row['rowid']).""; print ''; - print ""; + print ""; print ''; } diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index 59fe85e66ef..85406c46faa 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -274,7 +274,7 @@ if (!empty($conf->service->enabled)) print ''; print $form->textwithpicto($langs->trans("RootCategoryForProductsToSell"), $langs->trans("RootCategoryForProductsToSellDesc")); print ''; -print $form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEPOS_ROOT_CATEGORY_ID, 'TAKEPOS_ROOT_CATEGORY_ID', 64, 0, 0); +print img_object('', 'category', 'class="paddingright"').$form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEPOS_ROOT_CATEGORY_ID, 'TAKEPOS_ROOT_CATEGORY_ID', 64, 0, 0); print ajax_combobox('TAKEPOS_ROOT_CATEGORY_ID'); print "\n"; diff --git a/htdocs/takepos/genimg/qr.php b/htdocs/takepos/genimg/qr.php index f0c3bea82b9..c73e874a465 100644 --- a/htdocs/takepos/genimg/qr.php +++ b/htdocs/takepos/genimg/qr.php @@ -29,5 +29,5 @@ require '../../core/modules/barcode/doc/tcpdfbarcode.modules.php'; $key = GETPOST('key'); -$module = new modtcpdfbarcode($db); +$module = new modTcpdfbarcode($db); $result = $module->buildBarCode("http://www.takepos.com", 'QRCODE', 'Y'); diff --git a/htdocs/takepos/phone.php b/htdocs/takepos/phone.php index 80d67513bf2..eac1f40bfd1 100644 --- a/htdocs/takepos/phone.php +++ b/htdocs/takepos/phone.php @@ -31,14 +31,14 @@ if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); -require '../main.inc.php'; // Load $user and permissions +if (!defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; -if ($_SESSION["publicterminal"]){ - // Decode place if is a order from customer phone +if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { + // Decode place if it is an order from customer phone $key = GETPOST('key'); $place=dol_decode($key); } @@ -53,7 +53,7 @@ if ($setterminal > 0) $langs->loadLangs(array("bills", "orders", "commercial", "cashdesk", "receiptprinter")); -if ($_SESSION["publicterminal"]) { +if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { $_SESSION["takeposterminal"] = 1; // Use Terminal 1 for public customers } elseif (empty($user->rights->takepos->run)) { diff --git a/htdocs/takepos/public/auto_order.php b/htdocs/takepos/public/auto_order.php index c97edfdc0e7..5b463959b69 100644 --- a/htdocs/takepos/public/auto_order.php +++ b/htdocs/takepos/public/auto_order.php @@ -24,6 +24,10 @@ 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'; + $_SESSION["basiclayout"] = 1; $_SESSION["publicterminal"] = true; // Is a public customer -require '../phone.php'; + +define('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE', 1); +include '../phone.php';