+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see .
+--
+-- ============================================================================
+
+
+-- Table to store some translations of values of objects
+
+create table llx_object_lang
+(
+ rowid integer AUTO_INCREMENT PRIMARY KEY,
+ fk_object integer DEFAULT 0 NOT NULL,
+ type_object varchar(32) NOT NULL, -- 'thirdparty', 'contact', '...'
+ property varchar(32) NOT NULL,
+ lang varchar(5) DEFAULT 0 NOT NULL,
+ value text,
+ import_key varchar(14) DEFAULT NULL
+)ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_societe_rib.sql b/htdocs/install/mysql/tables/llx_societe_rib.sql
index 45084179908..7d00d9fb1dd 100644
--- a/htdocs/install/mysql/tables/llx_societe_rib.sql
+++ b/htdocs/install/mysql/tables/llx_societe_rib.sql
@@ -28,7 +28,7 @@ create table llx_societe_rib
fk_soc integer NOT NULL,
datec datetime,
tms timestamp,
-
+
-- For BAN
bank varchar(255), -- bank name
code_banque varchar(128), -- bank code
@@ -66,6 +66,7 @@ create table llx_societe_rib
--For Stripe
stripe_card_ref varchar(128), -- 'card_...'
+ stripe_account varchar(128), -- 'pk_live_...'
comment varchar(255),
ipaddress varchar(68),
diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang
index e33d1112deb..964bd7c436c 100644
--- a/htdocs/langs/en_US/cashdesk.lang
+++ b/htdocs/langs/en_US/cashdesk.lang
@@ -79,3 +79,5 @@ InvoiceIsAlreadyValidated=Invoice is already validated
NoLinesToBill=No lines to bill
CustomReceipt=Custom Receipt
ReceiptName=Receipt Name
+ProductSupplements=Product Supplements
+SupplementCategory=Supplement category
diff --git a/htdocs/societe/class/companypaymentmode.class.php b/htdocs/societe/class/companypaymentmode.class.php
index aa0c083f4f7..781a25ac8c0 100644
--- a/htdocs/societe/class/companypaymentmode.class.php
+++ b/htdocs/societe/class/companypaymentmode.class.php
@@ -110,6 +110,7 @@ class CompanyPaymentMode extends CommonObject
'preapproval_key' =>array('type'=>'varchar(255)', 'label'=>'Preapproval key', 'enabled'=>1, 'visible'=>-2, 'position'=>160),
'total_amount_of_all_payments' =>array('type'=>'double(24,8)', 'label'=>'Total amount of all payments', 'enabled'=>1, 'visible'=>-2, 'position'=>165),
'stripe_card_ref' =>array('type'=>'varchar(128)', 'label'=>'Stripe card ref', 'enabled'=>1, 'visible'=>-2, 'position'=>170),
+ 'stripe_account' =>array('type'=>'varchar(128)', 'label'=>'Stripe account', 'enabled'=>1, 'visible'=>-2, 'position'=>171),
'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>175),
'starting_date' =>array('type'=>'date', 'label'=>'Starting date', 'enabled'=>1, 'visible'=>-2, 'position'=>180),
'ending_date' =>array('type'=>'date', 'label'=>'Ending date', 'enabled'=>1, 'visible'=>-2, 'position'=>185),
diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php
index 9bf2a40f069..52af815827f 100644
--- a/htdocs/societe/paymentmodes.php
+++ b/htdocs/societe/paymentmodes.php
@@ -847,7 +847,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
$permissiontowrite = $user->rights->societe->creer;
// Stripe customer key 'cu_....' stored into llx_societe_account
print '| ';
- print $form->editfieldkey("StripeCustomerId", 'key_account', $stripecu, $object, $permissiontowrite, 'string', '', 0, 2, 'socid', 'Publishable key '.$site_account);
+ print $form->editfieldkey("StripeCustomerId", 'key_account', $stripecu, $object, $permissiontowrite, 'string', '', 0, 2, 'socid');
print ' | ';
print $form->editfieldval("StripeCustomerId", 'key_account', $stripecu, $object, $permissiontowrite, 'string', '', null, null, '', 2, '', 'socid');
if (!empty($conf->stripe->enabled) && $stripecu && $action != 'editkey_account')
@@ -859,7 +859,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
{
$url = 'https://dashboard.stripe.com/'.$connect.'customers/'.$stripecu;
}
- print ' '.img_picto($langs->trans('ShowInStripe'), 'globe').'';
+ print ' '.img_picto($langs->trans('ShowInStripe').' - Publishable key '.$site_account, 'globe').'';
}
print ' | ';
if (empty($stripecu))
@@ -913,7 +913,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
{
$url = 'https://dashboard.stripe.com/connect/accounts/'.$stripesupplieracc;
}
- print ' '.img_picto($langs->trans('ShowInStripe'), 'globe').'';
+ print ' '.img_picto($langs->trans('ShowInStripe').' - Publishable key '.$site_account, 'globe').'';
}
print ' | ';
if (empty($stripesupplieracc))
@@ -1065,7 +1065,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
{
$url = 'https://dashboard.stripe.com/'.$connect.'search?query='.$companypaymentmodetemp->stripe_card_ref;
}
- print ' '.img_picto($langs->trans('ShowInStripe'), 'globe').'';
+ print ' '.img_picto($langs->trans('ShowInStripe').' - Publishable key '.$companypaymentmodetemp->stripe_account, 'globe').'';
}
print ' | ';
print '';
diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php
index 895b82ac033..ebd0e0659e4 100644
--- a/htdocs/takepos/admin/setup.php
+++ b/htdocs/takepos/admin/setup.php
@@ -75,6 +75,8 @@ if (GETPOST('action', 'alpha') == 'set')
$res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTERS", GETPOST('TAKEPOS_ORDER_PRINTERS', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_ORDER_NOTES", GETPOST('TAKEPOS_ORDER_NOTES', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_PHONE_BASIC_LAYOUT", GETPOST('TAKEPOS_PHONE_BASIC_LAYOUT', 'alpha'), 'chaine', 0, '', $conf->entity);
+ $res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS", GETPOST('TAKEPOS_SUPPLEMENTS', 'alpha'), 'chaine', 0, '', $conf->entity);
+ $res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS_CATEGORY", GETPOST('TAKEPOS_SUPPLEMENTS_CATEGORY', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_AUTO_PRINT_TICKETS", GETPOST('TAKEPOS_AUTO_PRINT_TICKETS', 'int'), 'int', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_NUMPAD", GETPOST('TAKEPOS_NUMPAD', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_NUM_TERMINALS", GETPOST('TAKEPOS_NUM_TERMINALS', 'alpha'), 'chaine', 0, '', $conf->entity);
@@ -222,6 +224,22 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT)
print ' | ';
print $form->selectyesno("TAKEPOS_PHONE_BASIC_LAYOUT", $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT, 1);
print ' |
';
+
+ print '| ';
+ print $langs->trans("ProductSupplements");
+ print ' | ';
+ print $form->selectyesno("TAKEPOS_SUPPLEMENTS", $conf->global->TAKEPOS_SUPPLEMENTS, 1);
+ print ' |
';
+
+ if ($conf->global->TAKEPOS_SUPPLEMENTS)
+ {
+ print '| ';
+ print $langs->trans("SupplementCategory");
+ print ' | ';
+ print $form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEPOS_SUPPLEMENTS_CATEGORY, 'TAKEPOS_SUPPLEMENTS_CATEGORY', 64, 0, 0);
+ print ajax_combobox('TAKEPOS_SUPPLEMENTS_CATEGORY');
+ print " |
\n";
+ }
}
print '| ';
diff --git a/htdocs/takepos/ajax/ajax.php b/htdocs/takepos/ajax/ajax.php
index 7e3049f9f6e..74b24d78570 100644
--- a/htdocs/takepos/ajax/ajax.php
+++ b/htdocs/takepos/ajax/ajax.php
@@ -45,6 +45,7 @@ $id = GETPOST('id', 'int');
if ($action == 'getProducts') {
$object = new Categorie($db);
+ if ($category=="supplements") $category=$conf->global->TAKEPOS_SUPPLEMENTS_CATEGORY;
$result = $object->fetch($category);
if ($result > 0)
{
diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php
index 23bc09a7268..0b7ebff8548 100644
--- a/htdocs/takepos/invoice.php
+++ b/htdocs/takepos/invoice.php
@@ -87,6 +87,7 @@ $placeid = 0; // $placeid is id of invoice
$number = GETPOST('number', 'alpha');
$idline = GETPOST('idline', 'int');
+$selectedline = GETPOST('selectedline', 'int');
$desc = GETPOST('desc', 'alpha');
$pay = GETPOST('pay', 'alpha');
$amountofpayment = price2num(GETPOST('amount', 'alpha'));
@@ -276,7 +277,23 @@ if ($action == "addline")
$price_base_type = $prod->multiprices_base_type[$customer->price_level];
}
- $idoflineadded = $invoice->addline($prod->description, $price, 1, $tva_tx, $prod->localtax1_tx, $prod->localtax2_tx, $idproduct, $customer->remise_percent, '', 0, 0, 0, '', $price_base_type, $price_ttc, $prod->type, -1, 0, '', 0, 0, null, 0, '', 0, 100, '', null, 0);
+ if ($conf->global->TAKEPOS_SUPPLEMENTS)
+ {
+ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
+ $cat = new Categorie($db);
+ $categories = $cat->containing($idproduct, 'product');
+ $found = (array_search($conf->global->TAKEPOS_SUPPLEMENTS_CATEGORY, array_column($categories, 'id')));
+ if ($found !== false) // If this product is a supplement
+ {
+ $sql = "SELECT fk_parent_line FROM ".MAIN_DB_PREFIX."facturedet where rowid=$selectedline";
+ $resql = $db->query($sql);
+ $row = $db->fetch_array($resql);
+ if ($row[0]==null) $parent_line=$selectedline;
+ else $parent_line=$row[0]; //If the parent line is already a supplement, add the supplement to the main product
+ }
+ }
+
+ $idoflineadded = $invoice->addline($prod->description, $price, 1, $tva_tx, $prod->localtax1_tx, $prod->localtax2_tx, $idproduct, $customer->remise_percent, '', 0, 0, 0, '', $price_base_type, $price_ttc, $prod->type, -1, 0, '', 0, $parent_line, null, 0, '', 0, 100, '', null, 0);
$invoice->fetch($placeid);
}
@@ -689,6 +706,37 @@ if ($placeid > 0)
$tmplines = array_reverse($invoice->lines);
foreach ($tmplines as $line)
{
+ if ($line->fk_parent_line!=false)
+ {
+ $htmlsupplements[$line->fk_parent_line].=' |
fk_parent_line].=' order';
+ $htmlsupplements[$line->fk_parent_line].= '" id="'.$line->id.'">';
+ $htmlsupplements[$line->fk_parent_line].= '';
+ $htmlsupplements[$line->fk_parent_line].= img_picto('', 'rightarrow');
+ if ($line->product_label) $htmlsupplements[$line->fk_parent_line] .= $line->product_label;
+ if ($line->product_label && $line->desc) $htmlsupplements[$line->fk_parent_line] .= ' ';
+ if ($line->product_label != $line->desc)
+ {
+ $firstline = dolGetFirstLineOfText($line->desc);
+ if ($firstline != $line->desc)
+ {
+ $htmlsupplements[$line->fk_parent_line] .= $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc);
+ }
+ else
+ {
+ $htmlsupplements[$line->fk_parent_line] .= $line->desc;
+ }
+ }
+ $htmlsupplements[$line->fk_parent_line] .= ' | ';
+ if ($_SESSION["basiclayout"] != 1)
+ {
+ $htmlsupplements[$line->fk_parent_line] .= ''.vatrate($line->remise_percent, true).' | ';
+ $htmlsupplements[$line->fk_parent_line] .= ''.$line->qty.' | ';
+ $htmlsupplements[$line->fk_parent_line] .= ''.price($line->total_ttc).' | ';
+ }
+ $htmlsupplements[$line->fk_parent_line] .= '
'."\n";
+ continue;
+ }
$htmlforlines = '';
$htmlforlines .= ''.price($line->total_ttc).'';
}
$htmlforlines .= '
'."\n";
+ $htmlforlines .= $htmlsupplements[$line->id];
print $htmlforlines;
}
diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php
index fed82019d62..ba9f2318508 100644
--- a/htdocs/takepos/takepos.php
+++ b/htdocs/takepos/takepos.php
@@ -233,10 +233,14 @@ function LoadProducts(position, issubcat) {
console.log("LoadProducts");
var maxproduct = ;
- $('#catimg'+position).animate({opacity: '0.5'}, 1);
- $('#catimg'+position).animate({opacity: '1'}, 100);
- if (issubcat==true) currentcat=$('#prodiv'+position).data('rowid');
- else currentcat=$('#catdiv'+position).data('rowid');
+ if (position=="supplements") currentcat="supplements";
+ else
+ {
+ $('#catimg'+position).animate({opacity: '0.5'}, 1);
+ $('#catimg'+position).animate({opacity: '1'}, 100);
+ if (issubcat==true) currentcat=$('#prodiv'+position).data('rowid');
+ else currentcat=$('#catdiv'+position).data('rowid');
+ }
if (currentcat == undefined) return;
pageproducts=0;
ishow=0; //product to show counter
@@ -353,7 +357,7 @@ function ClickProduct(position) {
console.log("Click on product at position "+position+" for idproduct "+idproduct);
if (idproduct=="") return;
// Call page invoice.php to generate the section with product lines
- $("#poslines").load("invoice.php?action=addline&place="+place+"&idproduct="+idproduct, function() {
+ $("#poslines").load("invoice.php?action=addline&place="+place+"&idproduct="+idproduct+"&selectedline="+selectedline, function() {
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
});
}
@@ -723,6 +727,10 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT)
{
$menus[$r++]=array('title'=>''.$langs->trans("OrderNotes").'
', 'action'=>'TakeposOrderNotes();');
}
+ if ($conf->global->TAKEPOS_SUPPLEMENTS)
+ {
+ $menus[$r++]=array('title'=>''.$langs->trans("ProductSupplements").'
', 'action'=>'LoadProducts(\'supplements\');');
+ }
}
if ($conf->global->TAKEPOSCONNECTOR) {