From c5cf8b880504e9f5dd27ee39a91e6ed690f9c88e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 7 Jan 2024 13:38:13 +0100 Subject: [PATCH 1/5] Debug v19 --- htdocs/core/modules/modTakePos.class.php | 4 +- htdocs/langs/en_US/cashdesk.lang | 2 +- htdocs/takepos/css/phone.css | 5 +- htdocs/takepos/invoice.php | 61 ++++++++++++++++-------- htdocs/takepos/phone.php | 17 ++++--- htdocs/takepos/public/auto_order.php | 6 +-- 6 files changed, 57 insertions(+), 38 deletions(-) diff --git a/htdocs/core/modules/modTakePos.class.php b/htdocs/core/modules/modTakePos.class.php index 0db0ab32d77..06b5b79dbf3 100644 --- a/htdocs/core/modules/modTakePos.class.php +++ b/htdocs/core/modules/modTakePos.class.php @@ -222,8 +222,8 @@ class modTakePos extends DolibarrModules 'url'=>'/takepos/index.php', 'langs'=>'cashdesk', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>1000 + $r, - 'enabled'=>'$conf->takepos->enabled', // Define condition to show or hide menu entry. Use '$conf->takepos->enabled' if entry must be visible if module is enabled. - 'perms'=>'$user->rights->takepos->run', // Use 'perms'=>'$user->rights->takepos->level1->level2' if you want your menu with a permission rules + 'enabled'=>'isModEnabled("takepos")', // Define condition to show or hide menu entry. Use '$conf->takepos->enabled' if entry must be visible if module is enabled. + 'perms'=>'$user->hasRight("takepos", "run")', // Use 'perms'=>'$user->rights->takepos->level1->level2' if you want your menu with a permission rules 'target'=>'takepos', 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index a9b8a63fec6..fd5d558bb28 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -76,7 +76,7 @@ TerminalSelect=Select terminal you want to use: POSTicket=POS Ticket POSTerminal=POS Terminal POSModule=POS Module -BasicPhoneLayout=Use basic layout for phones +BasicPhoneLayout=On phones, replace the POS with a minimal layout (Record orders only, no invoice generation, no receipt printing) SetupOfTerminalNotComplete=Setup of terminal %s is not complete DirectPayment=Direct payment DirectPaymentButton=Add a "Direct cash payment" button diff --git a/htdocs/takepos/css/phone.css b/htdocs/takepos/css/phone.css index 2b0cf62797f..caae1a436db 100644 --- a/htdocs/takepos/css/phone.css +++ b/htdocs/takepos/css/phone.css @@ -90,7 +90,7 @@ button.publicphonebutton { vertical-align: middle; text-align: center; overflow: visible; /* removes extra width in IE */ - width:33%; + width:33.33%; height:50px; font-weight: bold; color: #fff; @@ -106,7 +106,6 @@ button.publicphonebutton { color: #fff; background-color: #5cb85c; border-color: #4cae4c; - font-size:20px; text-align:center; width:20px; } @@ -168,7 +167,7 @@ button.publicphonebutton2 { vertical-align: middle; text-align: center; overflow: visible; /* removes extra width in IE */ - width:33%; + width:33.33%; font-weight: bold; padding: 8px 16px; } diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 74f8a751934..06013482289 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -65,7 +65,7 @@ $mobilepage = GETPOST('mobilepage', 'alpha'); // Terminal is stored into $_SESSION["takeposterminal"]; if (!$user->hasRight('takepos', 'run') && !defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { - accessforbidden(); + accessforbidden('No permission to use the TakePOS'); } if ((getDolGlobalString('TAKEPOS_PHONE_BASIC_LAYOUT') == 1 && $conf->browser->layout == 'phone') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { @@ -475,7 +475,7 @@ if (empty($reshook)) { } } - if ($action == 'history' || $action == 'creditnote') { + if (($action == 'history' || $action == 'creditnote') && $user->hasRight('takepos', 'run')) { if ($action == 'creditnote') { $placeid = $creditnote->id; } else { @@ -486,7 +486,7 @@ if (empty($reshook)) { } // If we add a line and no invoice yet, we create the invoice - if (($action == "addline" || $action == "freezone") && $placeid == 0) { + if (($action == "addline" || $action == "freezone") && $placeid == 0 && $user->hasRight('facture', 'creer')) { $invoice->socid = getDolGlobalString($constforcompanyid); $invoice->date = dol_now('tzuserrel'); // We use the local date, only the day will be saved. $invoice->module_source = 'takepos'; @@ -507,7 +507,7 @@ if (empty($reshook)) { } } - if ($action == "addline") { + if ($action == "addline" && $user->hasRight('facture', 'creer')) { $prod = new Product($db); $prod->fetch($idproduct); @@ -695,7 +695,7 @@ if (empty($reshook)) { $invoice->fetch($placeid); } - if ($action == "freezone") { + if ($action == "freezone" && $user->hasRight('facture', 'creer')) { $customer = new Societe($db); $customer->fetch($invoice->socid); @@ -716,7 +716,7 @@ if (empty($reshook)) { $invoice->fetch($placeid); } - if ($action == "addnote") { + if ($action == "addnote" && $user->hasRight('facture', 'creer')) { $desc = GETPOST('addnote', 'alpha'); if ($idline==0) { $invoice->update_note($desc, '_public'); @@ -730,7 +730,7 @@ if (empty($reshook)) { $invoice->fetch($placeid); } - if ($action == "deleteline") { + if ($action == "deleteline" && $user->hasRight('facture', 'creer')) { if ($idline > 0 and $placeid > 0) { // If invoice exists and line selected. To avoid errors if deleted from another device or no line selected. $invoice->deleteline($idline); $invoice->fetch($placeid); @@ -750,7 +750,7 @@ if (empty($reshook)) { } // Action to delete or discard an invoice - if ($action == "delete") { + if ($action == "delete" && $user->hasRight('facture', 'creer')) { // $placeid is the invoice id (it differs from place) and is defined if the place is set and the ref of invoice is '(PROV-POS'.$_SESSION["takeposterminal"].'-'.$place.')', so the fetch at begining of page works. if ($placeid > 0) { $result = $invoice->fetch($placeid); @@ -786,11 +786,18 @@ if (empty($reshook)) { } } - if ($action == "updateqty") { + if ($action == "updateqty") { // Test on permission is done later foreach ($invoice->lines as $line) { if ($line->id == $idline) { - if (!$user->hasRight('takepos', 'editlines') || (!$user->hasRight('takepos', 'editorderedlines') && $line->special_code == "4")) { - dol_htmloutput_errors($langs->trans("NotEnoughPermissions", "TakePos"), null, 1); + $permissiontoupdateline = ($user->hasRight('takepos', 'editlines') && ($user->hasRight('takepos', 'editorderedlines') || $line->special_code != "4")); + if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { + if ($invoice->status == $invoice::STATUS_DRAFT && $invoice->pos_source && $invoice->module_source == 'takepos') { + $permissiontoupdateline = true; + // TODO Add also a test on $_SESSION('publicobjectid'] defined at creation of object + } + } + if (!$permissiontoupdateline) { + dol_htmloutput_errors($langs->trans("NotEnoughPermissions", "TakePos").' - No permission to updateqty', null, 1); } else { $result = $invoice->updateline($line->id, $line->desc, $line->subprice, $number, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); } @@ -800,7 +807,7 @@ if (empty($reshook)) { $invoice->fetch($placeid); } - if ($action == "updateprice") { + if ($action == "updateprice") { // Test on permission is done later $customer = new Societe($db); $customer->fetch($invoice->socid); @@ -818,8 +825,15 @@ if (empty($reshook)) { dol_htmloutput_errors($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency))); //echo $langs->trans("CantBeLessThanMinPrice"); } else { - if (!$user->hasRight('takepos', 'editlines') || (!$user->hasRight('takepos', 'editorderedlines') && $line->special_code == "4")) { - dol_htmloutput_errors($langs->trans("NotEnoughPermissions", "TakePos"), null, 1); + $permissiontoupdateline = ($user->hasRight('takepos', 'editlines') && ($user->hasRight('takepos', 'editorderedlines') || $line->special_code != "4")); + if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { + if ($invoice->status == $invoice::STATUS_DRAFT && $invoice->pos_source && $invoice->module_source == 'takepos') { + $permissiontoupdateline = true; + // TODO Add also a test on $_SESSION('publicobjectid'] defined at creation of object + } + } + if (!$permissiontoupdateline) { + dol_htmloutput_errors($langs->trans("NotEnoughPermissions", "TakePos").' - No permission to updateprice', null, 1); } elseif (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT') == 1) { $result = $invoice->updateline($line->id, $line->desc, $number, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); } else { @@ -833,7 +847,7 @@ if (empty($reshook)) { $invoice->fetch($placeid); } - if ($action == "updatereduction") { + if ($action == "updatereduction") { // Test on permission is done later $customer = new Societe($db); $customer->fetch($invoice->socid); @@ -855,7 +869,14 @@ if (empty($reshook)) { $langs->load("products"); dol_htmloutput_errors($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency))); } else { - if (!$user->hasRight('takepos', 'editlines') || (!$user->hasRight('takepos', 'editorderedlines') && $line->special_code == "4")) { + $permissiontoupdateline = ($user->hasRight('takepos', 'editlines') && ($user->hasRight('takepos', 'editorderedlines') || $line->special_code != "4")); + if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { + if ($invoice->status == $invoice::STATUS_DRAFT && $invoice->pos_source && $invoice->module_source == 'takepos') { + $permissiontoupdateline = true; + // TODO Add also a test on $_SESSION('publicobjectid'] defined at creation of object + } + } + if (!$permissiontoupdateline) { dol_htmloutput_errors($langs->trans("NotEnoughPermissions", "TakePos"), null, 1); } else { $result = $invoice->updateline($line->id, $line->desc, $line->subprice, $line->qty, $number, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); @@ -866,7 +887,7 @@ if (empty($reshook)) { // Reload data $invoice->fetch($placeid); - } elseif ($action == 'update_reduction_global') { + } elseif ($action == 'update_reduction_global' && $user->hasRight('takepos', 'editlines')) { foreach ($invoice->lines as $line) { $result = $invoice->updateline($line->id, $line->desc, $line->subprice, $line->qty, $number, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); } @@ -874,13 +895,13 @@ if (empty($reshook)) { $invoice->fetch($placeid); } - if ($action=="setbatch") { + if ($action=="setbatch" && $user->hasRight('takepos', 'run')) { $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set batch=".$db->escape($batch).", fk_warehouse=".getDolGlobalString($constantforkey)." where rowid=".((int) $idoflineadded); $db->query($sql); } - if ($action == "order" and $placeid != 0) { + if ($action == "order" && $placeid != 0 && $user->hasRight('takepos', 'run')) { include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter" || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") { require_once DOL_DOCUMENT_ROOT.'/core/class/dolreceiptprinter.class.php'; @@ -1005,7 +1026,7 @@ if (empty($reshook)) { } $sectionwithinvoicelink = ''; - if ($action == "valid" || $action == "history" || $action == 'creditnote') { + if (($action == "valid" || $action == "history" || $action == 'creditnote') && $user->hasRight('takepos', 'run')) { $sectionwithinvoicelink .= ''."\n"; $sectionwithinvoicelink .= ''; $sectionwithinvoicelink .= $invoice->getNomUrl(1, '', 0, 0, '', 0, 0, -1, '_backoffice')." - "; diff --git a/htdocs/takepos/phone.php b/htdocs/takepos/phone.php index 0becb24d769..989f2532504 100644 --- a/htdocs/takepos/phone.php +++ b/htdocs/takepos/phone.php @@ -63,7 +63,7 @@ if ($setterminal > 0) { $langs->loadLangs(array("bills", "orders", "commercial", "cashdesk", "receiptprinter")); if (!$user->hasRight('takepos', 'run') && !defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { - accessforbidden(); + accessforbidden('No permission to run the takepos'); } @@ -162,14 +162,14 @@ if ($action == "productinfo") {
'.dol_trunc($langs->trans('Floors'), 3, 'right', 'UTF-8', 1).''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; } else { - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; } ?>
@@ -180,7 +180,6 @@ if ($action == "productinfo") {
- ?> '."\n"; } +$usediv = (GETPOST('format') == 'div'); +$usediv = 0; + print ''."\n"; print '
'; -print ''; +if ($usediv) { + print '
'; +} else { + print '
'; +} if ($sectionwithinvoicelink && ($mobilepage == "invoice" || $mobilepage == "")) { if (getDolGlobalString('TAKEPOS_SHOW_HT')) { print ''; @@ -1488,38 +1501,42 @@ if ($sectionwithinvoicelink && ($mobilepage == "invoice" || $mobilepage == "")) print ''; } } -print ''; -print ''; + print ''; } -print ''; // complete header by hook $parameters=array(); @@ -1565,22 +1582,22 @@ if (empty($_SESSION["basiclayout"]) || $_SESSION["basiclayout"] != 1) { } elseif ($mobilepage == "invoice") { print ''; } -print "\n"; - +if (!$usediv) { + print "\n"; +} if (!empty($_SESSION["basiclayout"]) && $_SESSION["basiclayout"] == 1) { if ($mobilepage == "cats") { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $categorie = new Categorie($db); $categories = $categorie->get_full_arbo('product'); - $htmlforlines = ''; foreach ($categories as $row) { if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { - $htmlforlines .= '
'; + $htmlforlines .= ' onclick="LoadProducts('.$row['id'].');">'; if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { $htmlforlines .= '
'; } else { @@ -1593,7 +1610,6 @@ if (!empty($_SESSION["basiclayout"]) && $_SESSION["basiclayout"] == 1) { $htmlforlines .= ''."\n"; } } - $htmlforlines .= '
'.$sectionwithinvoicelink.'
'.$sectionwithinvoicelink.'
'; +if (!$usediv) { + print '
'; +} // In phone version only show when it is invoice page if (empty($mobilepage) || $mobilepage == "invoice") { print ''; print ''; print ''; } -if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) { - $sql = "SELECT floor, label FROM ".MAIN_DB_PREFIX."takepos_floor_tables where rowid=".((int) $place); - $resql = $db->query($sql); - $obj = $db->fetch_object($resql); - if ($obj) { - $label = $obj->label; - $floor = $obj->floor; +if (!$usediv) { + if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) { + $sql = "SELECT floor, label FROM ".MAIN_DB_PREFIX."takepos_floor_tables where rowid=".((int) $place); + $resql = $db->query($sql); + $obj = $db->fetch_object($resql); + if ($obj) { + $label = $obj->label; + $floor = $obj->floor; + } + if ($mobilepage == "invoice" || $mobilepage == "") { + // If not on smartphone version or if it is the invoice page + //print 'mobilepage='.$mobilepage; + print ''.$langs->trans('Place')." ".(empty($label) ? '?' : $label)."
"; + print ''.$langs->trans('Floor')." ".(empty($floor) ? '?' : $floor).""; + } elseif (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { + print $mysoc->name; + } elseif ($mobilepage == "cats") { + print $langs->trans('Category'); + } elseif ($mobilepage == "products") { + print $langs->trans('Label'); + } + } else { + print $langs->trans("Products"); } - if ($mobilepage == "invoice" || $mobilepage == "") { - // If not on smartphone version or if it is the invoice page - //print 'mobilepage='.$mobilepage; - print ''.$langs->trans('Place')." ".(empty($label) ? '?' : $label)."
"; - print ''.$langs->trans('Floor')." ".(empty($floor) ? '?' : $floor).""; - } elseif (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { - print $mysoc->name; - } elseif ($mobilepage == "cats") { - print $langs->trans('Category'); - } elseif ($mobilepage == "products") { - print $langs->trans('Label'); - } -} else { - print $langs->trans("Products"); + print '
'.$langs->trans('Qty').'
'; print $htmlforlines; } @@ -1606,7 +1622,7 @@ if (!empty($_SESSION["basiclayout"]) && $_SESSION["basiclayout"] == 1) { $htmlforlines = ''; foreach ($prods as $row) { if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { - $htmlforlines .= '
0) { print ''; } -print ''; +if ($usediv) { + print '
'; +} else { + print ''; +} if (($action == "valid" || $action == "history") && $invoice->type != Facture::TYPE_CREDIT_NOTE && !getDolGlobalString('TAKEPOS_NO_CREDITNOTE')) { print ''; diff --git a/htdocs/takepos/phone.php b/htdocs/takepos/phone.php index c67006b2e82..be7cfe954a1 100644 --- a/htdocs/takepos/phone.php +++ b/htdocs/takepos/phone.php @@ -276,10 +276,10 @@ if ($action == "productinfo") { place=placeid; @@ -287,26 +287,27 @@ if ($action == "productinfo") { } function SetQty(place, selectedline, qty){ + console.log("We click on SetQty()"); if (qty==0){ - $("#phonediv2").load("auto_order.php?mobilepage=invoice&action=deleteline&token=&place="+place+"&idline="+selectedline, function() { + $("#phonediv2").load("/takepos/public/auto_order.php?mobilepage=invoice&action=deleteline&token=&place="+place+"&idline="+selectedline, function() { }); } else{ - $("#phonediv2").load("auto_order.php?mobilepage=invoice&action=updateqty&token=&place="+place+"&idline="+selectedline+"&number="+qty, function() { + $("#phonediv2").load("/takepos/public/auto_order.php?mobilepage=invoice&action=updateqty&token=&place="+place+"&idline="+selectedline+"&number="+qty, function() { }); } if (qty==0){ - $("#phonediv2").load("invoice.php?mobilepage=invoice&action=deleteline&token=&place="+place+"&idline="+selectedline, function() { + $("#phonediv2").load("/takepos/invoice.php?load=1&mobilepage=invoice&action=deleteline&token=&place="+place+"&idline="+selectedline, function() { }); } else{ - $("#phonediv2").load("invoice.php?mobilepage=invoice&action=updateqty&token=&place="+place+"&idline="+selectedline+"&number="+qty, function() { + $("#phonediv2").load("/takepos/invoice.php?load=1&mobilepage=invoice&action=updateqty&token=&place="+place+"&idline="+selectedline+"&number="+qty, function() { }); } trans('Note'); ?>", ""); - $("#phonediv2").load("auto_order.php?mobilepage=invoice&action=updateqty&token=&place="+place+"&idline="+selectedline+"&number="+qty, function() { + console.log("We click on SetNote()"); + var note = prompt("trans('Note')); ?>", ""); + $("#phonediv2").load("/takepos/public/auto_order.php?mobilepage=invoice&action=updateqty&token=&place="+place+"&idline="+selectedline+"&number="+qty, function() { }); LoadCats(); } function LoadCats(){ + console.log("We click on LoadCats()"); } function LoadProducts(idcat) { + console.log("We click on LoadProducts()"); } @@ -376,7 +380,7 @@ if ($action == "productinfo") { } else{ console.log("Request the check to the waiter"); - $("#phonediv1").load("auto_order.php?action=checkplease&token=&place=&payment="+payment, function() { + $("#phonediv1").load("auto_order.php?action=checkplease&token=&place=&payment="+payment, function() { }); } } From 7f7f904541dfc241c212410db8e01956d97c68f2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 7 Jan 2024 20:00:21 +0100 Subject: [PATCH 3/5] Debug v19 --- htdocs/takepos/invoice.php | 15 +++--------- htdocs/takepos/phone.php | 50 +++++++++++++++++++++----------------- 2 files changed, 32 insertions(+), 33 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 7b69e796b08..87b1b480d5a 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -1145,7 +1145,7 @@ $(document).ready(function() { selectedtext=$('#'+selectedline).find("td:first").html(); @@ -1485,7 +1485,6 @@ if (!empty($conf->use_javascript_ajax)) { } $usediv = (GETPOST('format') == 'div'); -$usediv = 0; print ''."\n"; print '
'; @@ -1501,6 +1500,8 @@ if ($sectionwithinvoicelink && ($mobilepage == "invoice" || $mobilepage == "")) print ''.$sectionwithinvoicelink.''; } } + +// Show the list of selected product if (!$usediv) { print ''; print ''; @@ -1525,20 +1526,12 @@ if (!$usediv) { //print 'mobilepage='.$mobilepage; print ''.$langs->trans('Place')." ".(empty($label) ? '?' : $label)."
"; print ''.$langs->trans('Floor')." ".(empty($floor) ? '?' : $floor).""; - } elseif (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { - print $mysoc->name; - } elseif ($mobilepage == "cats") { - print $langs->trans('Category'); - } elseif ($mobilepage == "products") { - print $langs->trans('Label'); } - } else { - print $langs->trans("Products"); } print ''; } -// complete header by hook +// Complete header by hook $parameters=array(); $reshook=$hookmanager->executeHooks('completeTakePosInvoiceHeader', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { diff --git a/htdocs/takepos/phone.php b/htdocs/takepos/phone.php index be7cfe954a1..e6a3e696377 100644 --- a/htdocs/takepos/phone.php +++ b/htdocs/takepos/phone.php @@ -72,12 +72,13 @@ if (!$user->hasRight('takepos', 'run') && !defined('INCLUDE_PHONEPAGE_FROM_PUBLI * View */ +$title = 'TakePOS - Dolibarr '.DOL_VERSION; +if (getDolGlobalString('MAIN_APPLICATION_TITLE')) { + $title = 'TakePOS - ' . getDolGlobalString('MAIN_APPLICATION_TITLE'); +} + // llxHeader if (empty($mobilepage) && (empty($action) || ((getDolGlobalString('TAKEPOS_PHONE_BASIC_LAYOUT') == 1 && $conf->browser->layout == 'phone') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')))) { - $title = 'TakePOS - Dolibarr '.DOL_VERSION; - if (getDolGlobalString('MAIN_APPLICATION_TITLE')) { - $title = 'TakePOS - ' . getDolGlobalString('MAIN_APPLICATION_TITLE'); - } $head = ' @@ -92,7 +93,9 @@ if (empty($mobilepage) && (empty($action) || ((getDolGlobalString('TAKEPOS_PHONE print ''."\n"; } else { - top_httphead('text/html', 1); + top_htmlhead('', $title); + + print ''."\n"; } @@ -245,10 +248,10 @@ if ($action == "productinfo") { place=placeid; @@ -260,7 +263,7 @@ if ($action == "productinfo") { // If is a public terminal first show product information if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { print 'place=placeid; - $("#phonediv1").load("auto_order.php?action=productinfo&token='.newToken().'&place="+place+"&idproduct="+productid, function() { + $("#phonediv1").load("'.DOL_URL_ROOT.'/takepos/public/auto_order.php?action=productinfo&token='.newToken().'&place="+place+"&idproduct="+productid, function() { });'; } else { print 'AddProductConfirm(placeid, productid);'; @@ -268,7 +271,7 @@ if ($action == "productinfo") { } function PublicPreOrder(){ - $("#phonediv1").load("auto_order.php?action=publicpreorder&token=&place="+place, function() { + $("#phonediv1").load("'.DOL_URL_ROOT.'/takepos/public/auto_order.php?action=publicpreorder&token=&place="+place, function() { }); } @@ -279,7 +282,7 @@ if ($action == "productinfo") { echo '$("#phonediv2").load("'.DOL_URL_ROOT.'/takepos/public/auto_order.php?mobilepage=invoice&action=addline&token='.newToken().'&place="+place+"&idproduct="+productid, function() { });'; } else { - echo '$("#phonediv2").load("'.DOL_URL_ROOT.'/takepos/invoice.php?load=1&mobilepage=invoice&action=addline&token='.newToken().'&place="+place+"&idproduct="+productid, function() { + echo '$("#phonediv2").load("'.DOL_URL_ROOT.'/takepos/invoice.php?mobilepage=invoice&action=addline&token='.newToken().'&place="+place+"&idproduct="+productid, function() { });'; } ?> @@ -303,11 +306,11 @@ if ($action == "productinfo") { } else { ?> if (qty==0){ - $("#phonediv2").load("/takepos/invoice.php?load=1&mobilepage=invoice&action=deleteline&token=&place="+place+"&idline="+selectedline, function() { + $("#phonediv2").load("/takepos/invoice.php?mobilepage=invoice&action=deleteline&token=&place="+place+"&idline="+selectedline, function() { }); } else{ - $("#phonediv2").load("/takepos/invoice.php?load=1&mobilepage=invoice&action=updateqty&token=&place="+place+"&idline="+selectedline+"&number="+qty, function() { + $("#phonediv2").load("/takepos/invoice.php?mobilepage=invoice&action=updateqty&token=&place="+place+"&idline="+selectedline+"&number="+qty, function() { }); } @@ -342,10 +346,10 @@ if ($action == "productinfo") { console.log("We click on LoadProducts()"); } @@ -359,28 +363,30 @@ if ($action == "productinfo") { console.log("TakeposPrintingOrder"); } function Exit(){ - window.location.href='../user/logout.php?token='; + console.log("Click on Exit"); + window.location.href='/user/logout.php?token='; } function CheckPlease(payment){ + console.log("Click on CheckPlease"); if (payment==undefined){ - $("#phonediv1").load("auto_order.php?action=checkplease&token=&place="+place, function() { + $("#phonediv1").load("/takepos/public/auto_order.php?action=checkplease&token=&place="+place, function() { }); } else{ console.log("Request the check to the waiter"); - $("#phonediv1").load("auto_order.php?action=checkplease&token=&place=&payment="+payment, function() { + $("#phonediv1").load("/takepos/public/auto_order.php?action=checkplease&token=&place=&payment="+payment, function() { }); } } From 368efbb77f919bd2ffa7f84feeb56f3b1debc2cd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 7 Jan 2024 20:43:05 +0100 Subject: [PATCH 4/5] Debug v19 --- htdocs/takepos/css/phone.css | 5 +++++ htdocs/takepos/invoice.php | 2 +- htdocs/takepos/phone.php | 10 +++------- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/takepos/css/phone.css b/htdocs/takepos/css/phone.css index bd215afe7a5..d3f3630131b 100644 --- a/htdocs/takepos/css/phone.css +++ b/htdocs/takepos/css/phone.css @@ -197,3 +197,8 @@ button.publicphonebutton2 { resize: none; border: 1px solid grey; } + +img.imgwrapper { + max-width: 100%; + max-height: 100%; +} diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 87b1b480d5a..34446fbe3a0 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -1486,7 +1486,7 @@ if (!empty($conf->use_javascript_ajax)) { $usediv = (GETPOST('format') == 'div'); -print ''."\n"; +print ''."\n"; print '
'; if ($usediv) { print '
'; diff --git a/htdocs/takepos/phone.php b/htdocs/takepos/phone.php index e6a3e696377..4f11672982e 100644 --- a/htdocs/takepos/phone.php +++ b/htdocs/takepos/phone.php @@ -333,7 +333,7 @@ if ($action == "productinfo") { browser->layout == 'phone') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')))) { - print ''; - print ''; -} else { - // Case file is loaded by a js .load() -} +print ''; +print ''; $db->close(); From b60a152c2c3e76322be13326ed84797ff9b30f18 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 8 Jan 2024 17:52:19 +0100 Subject: [PATCH 5/5] Fix: Make executeRequest public htdocs/admin/dolistore/ajax/image.php uses executeRequest, changing that is more effort than making the method public. --- htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php | 2 +- htdocs/admin/dolistore/class/README.md | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php index 49850bb1d2b..647d68820e6 100644 --- a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php +++ b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php @@ -170,7 +170,7 @@ class PrestaShopWebservice * * @throws PrestaShopWebserviceException */ - protected function executeRequest($url, $curl_params = array()) + public function executeRequest($url, $curl_params = array()) { $defaultParams = $this->getCurlDefaultParams(); diff --git a/htdocs/admin/dolistore/class/README.md b/htdocs/admin/dolistore/class/README.md index b0f57af00e7..c4c8110e732 100644 --- a/htdocs/admin/dolistore/class/README.md +++ b/htdocs/admin/dolistore/class/README.md @@ -4,9 +4,13 @@ Source updated from: https://github.com/PrestaShop/PrestaShop-webservice-lib/blob/master/PSWebServiceLibrary.php -## Compatibility analysis +## License compatibility analysis https://www.gnu.org/licenses/license-list.html#OSL +## Local changes + +- Change `executeRequest` to public method because + `htdocs/admin/dolistore/ajax/image.php#` uses it.