Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
6f144a7ccf
8 changed files with 253 additions and 168 deletions
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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%;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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=<?php echo newToken() ?>&place="+place+"&idproduct="+idproduct+"&selectedline="+selectedline+"&qty="+qty, function() {
|
||||
$("#poslines").load("invoice.php?action=addline&token=<?php echo newToken() ?>&place="+place+"&idproduct="+idproduct+"&qty="+qty, function() {
|
||||
<?php if (getDolGlobalString('TAKEPOS_CUSTOMER_DISPLAY')) {
|
||||
echo "CustomerDisplay();";
|
||||
}?>
|
||||
|
|
@ -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=<?php echo newToken();?>&type=t&contextpage=poslist&idcustomer="+idcustomer+"&place="+place+"", function() {
|
||||
$("#poslines").load("<?php echo DOL_URL_ROOT ?>/societe/list.php?action=change&token=<?php echo newToken();?>&type=t&contextpage=poslist&idcustomer="+idcustomer+"&place="+place+"", function() {
|
||||
});
|
||||
|
||||
ClearSearch(false);
|
||||
|
|
@ -945,7 +947,7 @@ function WeighingScale(){
|
|||
url: '<?php print getDolGlobalString('TAKEPOS_PRINT_SERVER'); ?>/scale/index.php',
|
||||
})
|
||||
.done(function( editnumber ) {
|
||||
$("#poslines").load("invoice.php?&token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline+"&number="+editnumber, function() {
|
||||
$("#poslines").load("invoice.php?token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline+"&number="+editnumber, function() {
|
||||
editnumber="";
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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 .= '<!-- Section with invoice link -->'."\n";
|
||||
$sectionwithinvoicelink .= '<span style="font-size:120%;" class="center">';
|
||||
$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();
|
||||
<?php
|
||||
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
|
||||
print '$("#phonediv1").load("auto_order.php?action=editline&token='.newToken().'&placeid="+placeid+"&selectedline="+selectedline, function() {
|
||||
print '$("#phonediv1").load("'.DOL_URL_ROOT.'/takepos/public/auto_order.php?action=editline&token='.newToken().'&placeid="+placeid+"&selectedline="+selectedline, function() {
|
||||
});';
|
||||
}
|
||||
?>
|
||||
|
|
@ -1439,9 +1484,15 @@ if (!empty($conf->use_javascript_ajax)) {
|
|||
print '<script src="'.DOL_URL_ROOT.'/core/js/lib_foot.js.php?lang='.$langs->defaultlang.'"></script>'."\n";
|
||||
}
|
||||
|
||||
print '<!-- invoice.php place='.(int) $place.' invoice='.$invoice->ref.' mobilepage='.(empty($mobilepage) ? '' : $mobilepage).' $_SESSION["basiclayout"]='.(empty($_SESSION["basiclayout"]) ? '' : $_SESSION["basiclayout"]).' conf TAKEPOS_BAR_RESTAURANT='.getDolGlobalString('TAKEPOS_BAR_RESTAURANT').' -->'."\n";
|
||||
$usediv = (GETPOST('format') == 'div');
|
||||
|
||||
print '<!-- invoice.php place='.(int) $place.' invoice='.$invoice->ref.' usediv='.$usediv.', mobilepage='.(empty($mobilepage) ? '' : $mobilepage).' $_SESSION["basiclayout"]='.(empty($_SESSION["basiclayout"]) ? '' : $_SESSION["basiclayout"]).' conf TAKEPOS_BAR_RESTAURANT='.getDolGlobalString('TAKEPOS_BAR_RESTAURANT').' -->'."\n";
|
||||
print '<div class="div-table-responsive-no-min invoice">';
|
||||
print '<table id="tablelines" class="noborder noshadow postablelines centpercent">';
|
||||
if ($usediv) {
|
||||
print '<div id="tablelines">';
|
||||
} else {
|
||||
print '<table id="tablelines" class="noborder noshadow postablelines centpercent">';
|
||||
}
|
||||
if ($sectionwithinvoicelink && ($mobilepage == "invoice" || $mobilepage == "")) {
|
||||
if (getDolGlobalString('TAKEPOS_SHOW_HT')) {
|
||||
print '<tr><td colspan="5">'.$sectionwithinvoicelink.'</td></tr>';
|
||||
|
|
@ -1449,40 +1500,38 @@ if ($sectionwithinvoicelink && ($mobilepage == "invoice" || $mobilepage == ""))
|
|||
print '<tr><td colspan="4">'.$sectionwithinvoicelink.'</td></tr>';
|
||||
}
|
||||
}
|
||||
print '<tr class="liste_titre nodrag nodrop">';
|
||||
print '<td class="linecoldescription">';
|
||||
|
||||
// Show the list of selected product
|
||||
if (!$usediv) {
|
||||
print '<tr class="liste_titre nodrag nodrop">';
|
||||
print '<td class="linecoldescription">';
|
||||
}
|
||||
// In phone version only show when it is invoice page
|
||||
if (empty($mobilepage) || $mobilepage == "invoice") {
|
||||
print '<!-- hidden var used by some js functions -->';
|
||||
print '<input type="hidden" name="invoiceid" id="invoiceid" value="'.$invoice->id.'">';
|
||||
print '<input type="hidden" name="thirdpartyid" id="thirdpartyid" value="'.$invoice->socid.'">';
|
||||
}
|
||||
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 '<span class="opacitymedium">'.$langs->trans('Place')."</span> <b>".(empty($label) ? '?' : $label)."</b><br>";
|
||||
print '<span class="opacitymedium">'.$langs->trans('Floor')."</span> <b>".(empty($floor) ? '?' : $floor)."</b>";
|
||||
}
|
||||
}
|
||||
if ($mobilepage == "invoice" || $mobilepage == "") {
|
||||
// If not on smartphone version or if it is the invoice page
|
||||
//print 'mobilepage='.$mobilepage;
|
||||
print '<span class="opacitymedium">'.$langs->trans('Place')."</span> <b>".(empty($label) ? '?' : $label)."</b><br>";
|
||||
print '<span class="opacitymedium">'.$langs->trans('Floor')."</span> <b>".(empty($floor) ? '?' : $floor)."</b>";
|
||||
} 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 '</td>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// 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 '<td class="linecolqty right">'.$langs->trans('Qty').'</td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
if (!$usediv) {
|
||||
print "</tr>\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 .= '<div class="leftcat';
|
||||
$htmlforlines .= '<div class="leftcat"';
|
||||
} else {
|
||||
$htmlforlines .= '<tr class="drag drop oddeven posinvoiceline';
|
||||
$htmlforlines .= '<tr class="drag drop oddeven posinvoiceline"';
|
||||
}
|
||||
$htmlforlines .= '" onclick="LoadProducts('.$row['id'].');">';
|
||||
$htmlforlines .= ' onclick="LoadProducts('.$row['id'].');">';
|
||||
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
|
||||
$htmlforlines .= '<img class="imgwrapper" width="33%" src="'.DOL_URL_ROOT.'/takepos/public/auto_order.php?genimg=cat&query=cat&id='.$row['id'].'"><br>';
|
||||
} else {
|
||||
|
|
@ -1554,8 +1603,6 @@ if (!empty($_SESSION["basiclayout"]) && $_SESSION["basiclayout"] == 1) {
|
|||
$htmlforlines .= '</td></tr>'."\n";
|
||||
}
|
||||
}
|
||||
$htmlforlines .= '</table>';
|
||||
$htmlforlines .= '</table>';
|
||||
print $htmlforlines;
|
||||
}
|
||||
|
||||
|
|
@ -1586,7 +1633,6 @@ if (!empty($_SESSION["basiclayout"]) && $_SESSION["basiclayout"] == 1) {
|
|||
$htmlforlines .= '</tr>'."\n";
|
||||
}
|
||||
}
|
||||
$htmlforlines .= '</table>';
|
||||
print $htmlforlines;
|
||||
}
|
||||
|
||||
|
|
@ -1604,7 +1650,6 @@ if (!empty($_SESSION["basiclayout"]) && $_SESSION["basiclayout"] == 1) {
|
|||
$htmlforlines .= '</td>';
|
||||
$htmlforlines .= '</tr>'."\n";
|
||||
}
|
||||
$htmlforlines .= '</table>';
|
||||
print $htmlforlines;
|
||||
}
|
||||
}
|
||||
|
|
@ -1837,7 +1882,11 @@ if ($placeid > 0) {
|
|||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
if ($usediv) {
|
||||
print '</div>';
|
||||
} else {
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
if (($action == "valid" || $action == "history") && $invoice->type != Facture::TYPE_CREDIT_NOTE && !getDolGlobalString('TAKEPOS_NO_CREDITNOTE')) {
|
||||
print '<button id="buttonprint" type="button" onclick="ModalBox(\'ModalCreditNote\')">'.$langs->trans('CreateCreditNote').'</button>';
|
||||
|
|
|
|||
|
|
@ -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 = '<meta name="apple-mobile-web-app-title" content="TakePOS"/>
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>';
|
||||
$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 '<body style="background-color:#D1D1D1;">'."\n";
|
||||
} else {
|
||||
top_htmlhead('');
|
||||
top_htmlhead('', $title);
|
||||
|
||||
print '<body>'."\n";
|
||||
}
|
||||
|
||||
//llxHeader();
|
||||
print '<body style="background-color:#D1D1D1;">';
|
||||
|
||||
if ($action == "productinfo") {
|
||||
$prod = new Product($db);
|
||||
|
|
@ -104,37 +112,41 @@ if ($action == "productinfo") {
|
|||
print '<button type="button" class="publicphonebutton2 phoneblue total" onclick="TakeposPrintingOrder();">'.$langs->trans('Confirm').'</button>';
|
||||
print "<br><br>";
|
||||
print '<div class="comment">
|
||||
<textarea class="textinput" placeholder="'.$langs->trans('Note').'"></textarea>
|
||||
<textarea class="textinput " placeholder="'.$langs->trans('Note').'"></textarea>
|
||||
</div>';
|
||||
print '<br>';
|
||||
} elseif ($action == "publicpayment") {
|
||||
$langs->loadLangs(array("orders"));
|
||||
print '<h1>'.$langs->trans('StatusOrderDelivered').'</h1>';
|
||||
print '<h1>'.$langs->trans('Ordered').'</h1>';
|
||||
print '<button type="button" class="publicphonebutton2 phoneblue total" onclick="CheckPlease();">'.$langs->trans('Payment').'</button>';
|
||||
print '<br>';
|
||||
} elseif ($action == "checkplease") {
|
||||
if (GETPOSTISSET("payment")) {
|
||||
print '<h1>'.$langs->trans('StatusOrderDelivered').'</h1>';
|
||||
print '<h1>'.$langs->trans('Ordered').'</h1>';
|
||||
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 '<button type="button" class="publicphonebutton2 phoneblue total" onclick="CheckPlease(\'Cash\')">'.$langs->trans('Cash').'</button>';
|
||||
print '<button type="button" class="publicphonebutton2 phoneblue total" onclick="CheckPlease(\'CreditCard\')">'.$langs->trans('CreditCard').'</button>';
|
||||
print '<button type="button" class="publicphonebutton2 phoneblue total marginbottomonly" onclick="CheckPlease(\'Cash\')">'.$langs->trans('Cash').'</button>';
|
||||
print '<button type="button" class="publicphonebutton2 phoneblue total marginbottomonly" onclick="CheckPlease(\'CreditCard\')">'.$langs->trans('CreditCard').'</button>';
|
||||
print '<br>';
|
||||
}
|
||||
} elseif ($action == "editline") {
|
||||
|
|
@ -159,18 +171,21 @@ if ($action == "productinfo") {
|
|||
} else {
|
||||
?>
|
||||
<div class="container">
|
||||
<div class="phonebuttonsrow">
|
||||
<?php
|
||||
if (!defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
|
||||
print '<button type="button" class="phonebutton uppercase" onclick="LoadPlacesList();">'.dol_trunc($langs->trans('Floors'), 3, 'right', 'UTF-8', 1).'</button>';
|
||||
print '<button type="button" class="phonebutton uppercase" onclick="LoadCats();">'.dol_trunc($langs->trans('Categories'), 3, 'right', 'UTF-8', 1).'</button>';
|
||||
print '<button type="button" class="phonebutton uppercase" onclick="TakeposPrintingOrder();">'.dol_trunc($langs->trans('Order'), 3, 'right', 'UTF-8', 1).'</button>';
|
||||
print '<button type="button" class="phonebutton uppercase" onclick="Exit();">'.dol_trunc($langs->trans('Logout'), 3, 'right', 'UTF-8', 1).'</button>';
|
||||
} else {
|
||||
print '<button type="button" class="publicphonebutton phoneblue uppercase" onclick="LoadCats();">'.dol_trunc($langs->trans('Categories'), 5, 'right', 'UTF-8', 1).'</button>';
|
||||
print '<button type="button" class="publicphonebutton phoneorange uppercase" onclick="PublicPreOrder();">'.dol_trunc($langs->trans('Order'), 5, 'right', 'UTF-8', 1).'</button>';
|
||||
print '<button type="button" class="publicphonebutton phonegreen uppercase" onclick="CheckPlease();">'.dol_trunc($langs->trans('Payment'), 5, 'right', 'UTF-8', 1).'</button>';
|
||||
} ?>
|
||||
<div class="phonebuttonsrow center">
|
||||
<?php
|
||||
if (!defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
|
||||
print '<button type="button" class="phonebutton uppercase" onclick="LoadPlacesList();">'.dol_trunc($langs->trans('Floors'), 5, 'right', 'UTF-8').'</button>';
|
||||
print '<button type="button" class="phonebutton uppercase" onclick="LoadCats();">'.dol_trunc($langs->trans('Categories'), 5, 'right', 'UTF-8').'</button>';
|
||||
print '<button type="button" class="phonebutton uppercase" onclick="TakeposPrintingOrder();">'.dol_trunc($langs->trans('Order'), 5, 'right', 'UTF-8').'</button>';
|
||||
print '<button type="button" class="phonebutton uppercase" onclick="CheckPlease();">'.dol_trunc($langs->trans('Payment'), 5, 'right', 'UTF-8').'</button>';
|
||||
print '<button type="button" class="phonebutton uppercase" onclick="Exit();">'.dol_trunc($langs->trans('Logout'), 5, 'right', 'UTF-8').'</button>';
|
||||
} else {
|
||||
print '<button type="button" class="publicphonebutton phoneblue uppercase" onclick="LoadCats();">'.dol_trunc($langs->trans('Categories'), 8, 'right', 'UTF-8').'</button>';
|
||||
print '<button type="button" class="publicphonebutton phoneorange uppercase" onclick="PublicPreOrder();">'.dol_trunc($langs->trans('Order'), 8, 'right', 'UTF-8').'</button>';
|
||||
// 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 '<button type="button" class="publicphonebutton phonegreen uppercase" onclick="CheckPlease();">'.dol_trunc($langs->trans('Payment'), 8, 'right', 'UTF-8').'</button>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="phonerow2">
|
||||
<div id="phonediv2" class="phonediv2"></div>
|
||||
|
|
@ -180,7 +195,6 @@ if ($action == "productinfo") {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
<?php
|
||||
$categorie = new Categorie($db);
|
||||
|
|
@ -234,12 +248,13 @@ if ($action == "productinfo") {
|
|||
place=placeid;
|
||||
<?php
|
||||
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
|
||||
echo '$("#phonediv2").load("auto_order.php?mobilepage=invoice&place="+place, function() {
|
||||
echo '$("#phonediv2").load("'.DOL_URL_ROOT.'/takepos/public/auto_order.php?mobilepage=invoice&place="+place+" #tablelines", function() {
|
||||
});';
|
||||
} else {
|
||||
echo '$("#phonediv2").load("invoice.php?mobilepage=invoice&place="+place, function() {
|
||||
echo '$("#phonediv2").load("'.DOL_URL_ROOT.'/takepos/invoice.php?mobilepage=invoice&place="+place+" #tablelines", function() {
|
||||
});';
|
||||
} ?>
|
||||
}
|
||||
?>
|
||||
LoadCats();
|
||||
}
|
||||
|
||||
|
|
@ -248,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);';
|
||||
|
|
@ -256,7 +271,7 @@ if ($action == "productinfo") {
|
|||
}
|
||||
|
||||
function PublicPreOrder(){
|
||||
$("#phonediv1").load("auto_order.php?action=publicpreorder&token=<?php echo newToken(); ?>&place="+place, function() {
|
||||
$("#phonediv1").load("'.DOL_URL_ROOT.'/takepos/public/auto_order.php?action=publicpreorder&token=<?php echo newToken(); ?>&place="+place, function() {
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -264,10 +279,10 @@ if ($action == "productinfo") {
|
|||
place=placeid;
|
||||
<?php
|
||||
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
|
||||
echo '$("#phonediv2").load("auto_order.php?mobilepage=invoice&action=addline&token='.newToken().'&place="+place+"&idproduct="+productid, function() {
|
||||
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("invoice.php?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() {
|
||||
});';
|
||||
} ?>
|
||||
|
||||
|
|
@ -275,26 +290,27 @@ if ($action == "productinfo") {
|
|||
}
|
||||
|
||||
function SetQty(place, selectedline, qty){
|
||||
console.log("We click on SetQty()");
|
||||
<?php
|
||||
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
|
||||
?>
|
||||
if (qty==0){
|
||||
$("#phonediv2").load("auto_order.php?mobilepage=invoice&action=deleteline&token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline, function() {
|
||||
$("#phonediv2").load("<?php echo DOL_URL_ROOT ?>/takepos/public/auto_order.php?mobilepage=invoice&action=deleteline&token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline, function() {
|
||||
});
|
||||
}
|
||||
else{
|
||||
$("#phonediv2").load("auto_order.php?mobilepage=invoice&action=updateqty&token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline+"&number="+qty, function() {
|
||||
$("#phonediv2").load("<?php echo DOL_URL_ROOT ?>/takepos/public/auto_order.php?mobilepage=invoice&action=updateqty&token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline+"&number="+qty, function() {
|
||||
});
|
||||
}
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
if (qty==0){
|
||||
$("#phonediv2").load("invoice.php?mobilepage=invoice&action=deleteline&token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline, function() {
|
||||
$("#phonediv2").load("<?php echo DOL_URL_ROOT ?>/takepos/invoice.php?mobilepage=invoice&action=deleteline&token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline, function() {
|
||||
});
|
||||
}
|
||||
else{
|
||||
$("#phonediv2").load("invoice.php?mobilepage=invoice&action=updateqty&token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline+"&number="+qty, function() {
|
||||
$("#phonediv2").load("<?php echo DOL_URL_ROOT ?>/takepos/invoice.php?mobilepage=invoice&action=updateqty&token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline+"&number="+qty, function() {
|
||||
});
|
||||
}
|
||||
<?php
|
||||
|
|
@ -305,31 +321,35 @@ if ($action == "productinfo") {
|
|||
}
|
||||
|
||||
function SetNote(place, selectedline){
|
||||
var note = prompt("<?php $langs->trans('Note'); ?>", "");
|
||||
$("#phonediv2").load("auto_order.php?mobilepage=invoice&action=updateqty&token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline+"&number="+qty, function() {
|
||||
console.log("We click on SetNote()");
|
||||
var note = prompt("<?php dol_escape_js($langs->trans('Note')); ?>", "");
|
||||
$("#phonediv2").load("<?php echo DOL_URL_ROOT ?>/takepos/public/auto_order.php?mobilepage=invoice&action=updateqty&token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline+"&number="+qty, function() {
|
||||
});
|
||||
LoadCats();
|
||||
}
|
||||
|
||||
function LoadCats(){
|
||||
console.log("We click on LoadCats()");
|
||||
<?php
|
||||
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
|
||||
echo '$("#phonediv1").load("auto_order.php?mobilepage=cats&place="+place, function() {
|
||||
// Load invoice.php to get categories by using auto_order so it will define INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE
|
||||
echo '$("#phonediv1").load("'.DOL_URL_ROOT.'/takepos/public/auto_order.php?format=div&mobilepage=cats&place="+place+" #tablelines", function() {
|
||||
});';
|
||||
} else {
|
||||
echo '$("#phonediv1").load("invoice.php?mobilepage=cats&place="+place, function() {
|
||||
echo '$("#phonediv1").load("'.DOL_URL_ROOT.'/takepos/invoice.php?mobilepage=cats&place="+place+"", function() {
|
||||
});';
|
||||
} ?>
|
||||
}
|
||||
?>
|
||||
}
|
||||
|
||||
function LoadProducts(idcat){
|
||||
|
||||
function LoadProducts(idcat) {
|
||||
console.log("We click on LoadProducts()");
|
||||
<?php
|
||||
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
|
||||
echo '$("#phonediv1").load("auto_order.php?mobilepage=products&catid="+idcat+"&place="+place, function() {
|
||||
echo '$("#phonediv1").load("'.DOL_URL_ROOT.'/takepos/public/auto_order.php?format=div&mobilepage=products&catid="+idcat+"&place="+place+"", function() {
|
||||
});';
|
||||
} else {
|
||||
echo '$("#phonediv1").load("invoice.php?mobilepage=products&catid="+idcat+"&place="+place, function() {
|
||||
echo '$("#phonediv1").load("'.DOL_URL_ROOT.'/takepos/invoice.php?mobilepage=products&catid="+idcat+"&place="+place+"", function() {
|
||||
});';
|
||||
} ?>
|
||||
}
|
||||
|
|
@ -343,28 +363,30 @@ if ($action == "productinfo") {
|
|||
console.log("TakeposPrintingOrder");
|
||||
<?php
|
||||
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
|
||||
echo '$("#phonediv2").load("auto_order.php?action=order&token='.newToken().'&mobilepage=order&place="+place, function() {
|
||||
echo '$("#phonediv2").load("'.DOL_URL_ROOT.'/takepos/public/auto_order.php?action=order&token='.newToken().'&mobilepage=order&place="+place, function() {
|
||||
});';
|
||||
echo '$("#phonediv1").load("auto_order.php?action=publicpayment&token='.newToken().'&place="+place, function() {
|
||||
echo '$("#phonediv1").load("'.DOL_URL_ROOT.'/takepos/public/auto_order.php?action=publicpayment&token='.newToken().'&place="+place, function() {
|
||||
});';
|
||||
} else {
|
||||
echo '$("#phonediv2").load("invoice.php?action=order&token='.newToken().'&place="+place, function() {
|
||||
echo '$("#phonediv2").load("'.DOL_URL_ROOT.'/takepos/invoice.php?action=order&token='.newToken().'&place="+place, function() {
|
||||
});';
|
||||
} ?>
|
||||
}
|
||||
|
||||
function Exit(){
|
||||
window.location.href='../user/logout.php?token=<?php echo newToken(); ?>';
|
||||
console.log("Click on Exit");
|
||||
window.location.href='<?php echo DOL_URL_ROOT ?>/user/logout.php?token=<?php echo newToken(); ?>';
|
||||
}
|
||||
|
||||
function CheckPlease(payment){
|
||||
console.log("Click on CheckPlease");
|
||||
if (payment==undefined){
|
||||
$("#phonediv1").load("auto_order.php?action=checkplease&token=<?php echo newToken(); ?>&place="+place, function() {
|
||||
$("#phonediv1").load("<?php echo DOL_URL_ROOT ?>/takepos/public/auto_order.php?action=checkplease&token=<?php echo newToken(); ?>&place="+place, function() {
|
||||
});
|
||||
}
|
||||
else{
|
||||
console.log("Request the check to the waiter");
|
||||
$("#phonediv1").load("auto_order.php?action=checkplease&token=<?php echo newToken(); ?>&place=<?php echo $place; ?>&payment="+payment, function() {
|
||||
$("#phonediv1").load("<?php echo DOL_URL_ROOT ?>/takepos/public/auto_order.php?action=checkplease&token=<?php echo newToken(); ?>&place=<?php echo urlencode($place); ?>&payment="+payment, function() {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -378,6 +400,8 @@ if ($action == "productinfo") {
|
|||
}
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
print '</body>';
|
||||
print '</html>';
|
||||
|
||||
|
||||
$db->close();
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ if (!defined('NOBROWSERNOTIF')) {
|
|||
require '../../main.inc.php';
|
||||
|
||||
if (!getDolGlobalString('TAKEPOS_AUTO_ORDER')) {
|
||||
accessforbidden(); // If Auto Order is disabled never allow NO LOGIN access
|
||||
accessforbidden('Auto order is not allwed'); // If Auto Order is disabled never allow access to this page (that is a NO LOGIN access)
|
||||
}
|
||||
|
||||
$_SESSION["basiclayout"] = 1;
|
||||
$_SESSION["takeposterminal"] = 1;
|
||||
$_SESSION["basiclayout"] = 1; // For the simple layout for public submission
|
||||
$_SESSION["takeposterminal"] = getDolGlobalInt('TAKEPOS_TERMINAL_NB_FOR_PUBLIC', 1); // Default terminal for public submission is 1
|
||||
|
||||
define('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE', 1);
|
||||
if (GETPOSTISSET("mobilepage")) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue