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. 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/takepos/css/phone.css b/htdocs/takepos/css/phone.css index caae1a436db..d3f3630131b 100644 --- a/htdocs/takepos/css/phone.css +++ b/htdocs/takepos/css/phone.css @@ -31,7 +31,8 @@ html,body { .phonebuttonsrow{ margin: 0 auto; width: 100%; - height: 5%; + padding-top: 5px; + padding-bottom: 10px; } .phonediv1{ @@ -76,7 +77,7 @@ button.phonebutton { vertical-align: middle; text-align: center; overflow: visible; /* removes extra width in IE */ - width:24%; + padding: 6px; height:90%; font-weight: bold; } @@ -91,25 +92,11 @@ button.publicphonebutton { text-align: center; overflow: visible; /* removes extra width in IE */ width:33.33%; - height:50px; + height: 2em; font-weight: bold; color: #fff; } -.phoneblue{ - color: #fff; - background-color: #428bca; - border-color: #357ebd; -} - -.phonegreen{ - color: #fff; - background-color: #5cb85c; - border-color: #4cae4c; - text-align:center; - width:20px; -} - .phonetable{ width:130px; } @@ -117,23 +104,38 @@ button.publicphonebutton { .phoneqty{ font-size:24px; font-weight: bold; - - +} + +.phoneblue{ + color: #fff; + background-color: #428bca; + border-color: #357ebd; + border-width: inherit; +} + +.phonegreen{ + color: #fff; + background-color: #5cb85c; + border-color: #4cae4c; + text-align:center; + width:20px; + border-width: inherit; } .phonered{ color: #fff; background-color: #dc3545; border-color: #dc3545; - font-size:20px; text-align:center; width:20px; + border-width: inherit; } .phoneorange{ color: #fff; background-color: #f0ad4e; border-color: #eea236; + border-width: inherit; } .total{ @@ -189,10 +191,14 @@ button.publicphonebutton2 { } .textinput { - float: left; - width: 100%; min-height: 75px; + width: 90%; outline: none; resize: none; border: 1px solid grey; } + +img.imgwrapper { + max-width: 100%; + max-height: 100%; +} diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 47c93d12390..d6e414b515b 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -84,12 +84,14 @@ $maxproductbydefaultforthisdevice = 24; if ($conf->browser->layout == 'phone') { $maxcategbydefaultforthisdevice = 8; $maxproductbydefaultforthisdevice = 16; - //REDIRECT TO BASIC LAYOUT IF TERMINAL SELECTED AND BASIC MOBILE LAYOUT ENABLED - if ($_SESSION["takeposterminal"] != "" && getDolGlobalInt('TAKEPOS_PHONE_BASIC_LAYOUT') == 1) { + //REDIRECT TO BASIC LAYOUT IF TERMINAL SELECTED AND BASIC MOBILE LAYOUT FORCED + if (!empty($_SESSION["takeposterminal"]) && getDolGlobalInt('TAKEPOS_PHONE_BASIC_LAYOUT') == 1) { $_SESSION["basiclayout"] = 1; header("Location: phone.php?mobilepage=invoice"); exit; } +} else { + unset($_SESSION["basiclayout"]); } $MAXCATEG = (!getDolGlobalString('TAKEPOS_NB_MAXCATEG') ? $maxcategbydefaultforthisdevice : $conf->global->TAKEPOS_NB_MAXCATEG); $MAXPRODUCT = (!getDolGlobalString('TAKEPOS_NB_MAXPRODUCT') ? $maxproductbydefaultforthisdevice : $conf->global->TAKEPOS_NB_MAXPRODUCT); @@ -494,7 +496,7 @@ function ClickProduct(position, qty = 1) { console.log("Click on product at position "+position+" for idproduct "+idproduct+", qty="+qty); if (idproduct=="") return; // Call page invoice.php to generate the section with product lines - $("#poslines").load("invoice.php?action=addline&token=&place="+place+"&idproduct="+idproduct+"&selectedline="+selectedline+"&qty="+qty, function() { + $("#poslines").load("invoice.php?action=addline&token=&place="+place+"&idproduct="+idproduct+"&qty="+qty, function() { @@ -507,7 +509,7 @@ function ClickProduct(position, qty = 1) { function ChangeThirdparty(idcustomer) { console.log("ChangeThirdparty"); // Call page list.php to change customer - $("#poslines").load("../societe/list.php?action=change&token=&type=t&contextpage=poslist&idcustomer="+idcustomer+"&place="+place+"", function() { + $("#poslines").load("/societe/list.php?action=change&token=&type=t&contextpage=poslist&idcustomer="+idcustomer+"&place="+place+"", function() { }); ClearSearch(false); @@ -945,7 +947,7 @@ function WeighingScale(){ url: '/scale/index.php', }) .done(function( editnumber ) { - $("#poslines").load("invoice.php?&token=&place="+place+"&idline="+selectedline+"&number="+editnumber, function() { + $("#poslines").load("invoice.php?token=&place="+place+"&idline="+selectedline+"&number="+editnumber, function() { editnumber=""; }); }); diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index cda20c6bced..5f27b1a1f21 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('takepos', 'run') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE'))) { $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('takepos', 'run') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE'))) { $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('takepos', 'run')) { $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('takepos', 'run') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE'))) { $desc = GETPOST('addnote', 'alpha'); if ($idline==0) { $invoice->update_note($desc, '_public'); @@ -730,8 +730,18 @@ if (empty($reshook)) { $invoice->fetch($placeid); } - if ($action == "deleteline") { - if ($idline > 0 and $placeid > 0) { // If invoice exists and line selected. To avoid errors if deleted from another device or no line selected. + if ($action == "deleteline" && ($user->hasRight('takepos', 'run') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE'))) { + /* + $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 + // TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the invoice ID + } + }*/ + + if ($idline > 0 && $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); } elseif ($placeid > 0) { // If invoice exists but no line selected, proceed to delete last line. @@ -742,15 +752,20 @@ if (empty($reshook)) { $invoice->deleteline($deletelineid); $invoice->fetch($placeid); } + if (count($invoice->lines) == 0) { $invoice->delete($user); - header("Location: ".DOL_URL_ROOT."/takepos/invoice.php"); + if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { + header("Location: ".DOL_URL_ROOT."/takepos/public/auto_order.php"); + } else { + header("Location: ".DOL_URL_ROOT."/takepos/invoice.php"); + } exit; } } // Action to delete or discard an invoice - if ($action == "delete") { + if ($action == "delete" && ($user->hasRight('takepos', 'run') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE'))) { // $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 +801,19 @@ 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 + // TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the invoice ID + } + } + 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 +823,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 +841,16 @@ 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 + // TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the invoice ID + } + } + 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 +864,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 +886,15 @@ 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 + // TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the invoice ID + } + } + 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 +905,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 +913,13 @@ if (empty($reshook)) { $invoice->fetch($placeid); } - if ($action=="setbatch") { + if ($action=="setbatch" && ($user->hasRight('takepos', 'run') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE'))) { $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') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE'))) { 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 +1044,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')." - "; @@ -1095,12 +1134,18 @@ $(document).ready(function() { console.log("Click done on "+this.id); $('.posinvoiceline').removeClass("selected"); $(this).addClass("selected"); - if (selectedline==this.id) return; // If is already selected - else selectedline=this.id; + if (!this.id) { + return; + } + if (selectedline == this.id) { + return; // If is already selected + } else { + selectedline = this.id; + } selectedtext=$('#'+selectedline).find("td:first").html(); @@ -1439,9 +1484,15 @@ if (!empty($conf->use_javascript_ajax)) { print ''."\n"; } -print ''."\n"; +$usediv = (GETPOST('format') == 'div'); + +print ''."\n"; print '
'; -print ''; +if ($usediv) { + print '
'; +} else { + print '
'; +} if ($sectionwithinvoicelink && ($mobilepage == "invoice" || $mobilepage == "")) { if (getDolGlobalString('TAKEPOS_SHOW_HT')) { print ''; @@ -1449,40 +1500,38 @@ if ($sectionwithinvoicelink && ($mobilepage == "invoice" || $mobilepage == "")) print ''; } } -print ''; -print ''; + print ''; } -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) { @@ -1526,22 +1575,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 { @@ -1554,8 +1603,6 @@ if (!empty($_SESSION["basiclayout"]) && $_SESSION["basiclayout"] == 1) { $htmlforlines .= ''."\n"; } } - $htmlforlines .= '
'.$sectionwithinvoicelink.'
'.$sectionwithinvoicelink.'
'; + +// Show the list of selected product +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).""; + } } - 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').'
'; - $htmlforlines .= ''; print $htmlforlines; } @@ -1586,7 +1633,6 @@ if (!empty($_SESSION["basiclayout"]) && $_SESSION["basiclayout"] == 1) { $htmlforlines .= ''."\n"; } } - $htmlforlines .= ''; print $htmlforlines; } @@ -1604,7 +1650,6 @@ if (!empty($_SESSION["basiclayout"]) && $_SESSION["basiclayout"] == 1) { $htmlforlines .= ''; $htmlforlines .= ''."\n"; } - $htmlforlines .= ''; print $htmlforlines; } } @@ -1837,7 +1882,11 @@ if ($placeid > 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 b23b7996910..4f11672982e 100644 --- a/htdocs/takepos/phone.php +++ b/htdocs/takepos/phone.php @@ -47,7 +47,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { - // Decode place if it is an order from customer phone + // Decode place if it is an order from a customer phone $place = GETPOSTISSET("key") ? dol_decode(GETPOST('key')) : GETPOST('place', 'aZ09'); } else { $place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Ba or Restaurant @@ -55,6 +55,7 @@ if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { $action = GETPOST('action', 'aZ09'); $setterminal = GETPOST('setterminal', 'int'); $idproduct = GETPOST('idproduct', 'int'); +$mobilepage = GETPOST('mobilepage', 'alphanohtml'); // Set when page is loaded by a js .load() if ($setterminal > 0) { $_SESSION["takeposterminal"] = $setterminal; @@ -63,7 +64,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'); } @@ -71,25 +72,32 @@ if (!$user->hasRight('takepos', 'run') && !defined('INCLUDE_PHONEPAGE_FROM_PUBLI * View */ -if (empty($action)) { - // Code for llxHeader() - $title = 'TakePOS - Dolibarr '.DOL_VERSION; - if (getDolGlobalString('MAIN_APPLICATION_TITLE')) { - $title = 'TakePOS - ' . getDolGlobalString('MAIN_APPLICATION_TITLE'); - } +$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')))) { $head = ' '; - $arrayofcss = array('/takepos/css/phone.css'); + $arrayofcss = array( + '/takepos/css/phone.css', + ); + $arrayofjs = array('/takepos/js/jquery.colorbox-min.js'); + $disablejs = 0; + $disablehead = 0; + top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); - top_htmlhead($head, $title, 0, 0, '', $arrayofcss); + print ''."\n"; } else { - top_htmlhead(''); + top_htmlhead('', $title); + + print ''."\n"; } -//llxHeader(); -print ''; if ($action == "productinfo") { $prod = new Product($db); @@ -104,37 +112,41 @@ if ($action == "productinfo") { print ''; print "

"; print '
- +
'; print '
'; } elseif ($action == "publicpayment") { $langs->loadLangs(array("orders")); - print '

'.$langs->trans('StatusOrderDelivered').'

'; + print '

'.$langs->trans('Ordered').'

'; print ''; print '
'; } elseif ($action == "checkplease") { if (GETPOSTISSET("payment")) { - print '

'.$langs->trans('StatusOrderDelivered').'

'; + print '

'.$langs->trans('Ordered').'

'; require_once DOL_DOCUMENT_ROOT.'/core/class/dolreceiptprinter.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $printer = new dolReceiptPrinter($db); $printer->initPrinter(getDolGlobalString('TAKEPOS_PRINTER_TO_USE'.$_SESSION["takeposterminal"])); - $printer->printer->feed(); - $printer->printer->feed(); - $printer->printer->text($langs->trans('IM')); - $printer->printer->feed(); - $printer->printer->text($langs->trans('Place').": ".$place); - $printer->printer->feed(); - $printer->printer->text($langs->trans('Payment').": ".$langs->trans(GETPOST('payment', 'alpha'))); - $printer->printer->feed(); - $printer->printer->feed(); - $printer->printer->feed(); - $printer->printer->feed(); - $printer->printer->feed(); - $printer->close(); + if ($printer->getPrintConnector()) { + if (!is_null($printer->printer)) { + $printer->printer->feed(); + $printer->printer->feed(); + $printer->printer->text($langs->trans('IM')); + $printer->printer->feed(); + $printer->printer->text($langs->trans('Place').": ".$place); + $printer->printer->feed(); + $printer->printer->text($langs->trans('Payment').": ".$langs->trans(GETPOST('payment', 'alpha'))); + $printer->printer->feed(); + $printer->printer->feed(); + $printer->printer->feed(); + $printer->printer->feed(); + $printer->printer->feed(); + } + $printer->close(); + } } else { - print ''; - print ''; + print ''; + print ''; print '
'; } } elseif ($action == "editline") { @@ -159,18 +171,21 @@ if ($action == "productinfo") { } else { ?>
-
- '.dol_trunc($langs->trans('Floors'), 3, 'right', 'UTF-8', 1).''; - print ''; - print ''; - print ''; - } else { - print ''; - print ''; - print ''; - } ?> +
+ '.dol_trunc($langs->trans('Floors'), 5, 'right', 'UTF-8').''; + print ''; + print ''; + print ''; + print ''; + } else { + print ''; + print ''; + // Do not show the payment link when order done from public page (a customer must not be able to set its order to paid himself) + //print ''; + } + ?>
@@ -180,7 +195,6 @@ if ($action == "productinfo") {
- ?>