Merge branch 'develop' into FIX_develop_urls_longer_than_255_chars_get_truncated_in_bookmarks

This commit is contained in:
Laurent Destailleur 2019-12-30 22:25:06 +01:00 committed by GitHub
commit 8838dc38db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 178 additions and 17 deletions

View File

@ -193,14 +193,14 @@ $enabledisablehtml .= $langs->trans("EnableDefaultValues").' ';
if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES))
{
// Button off, click to enable
$enabledisablehtml .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=1'.$param.'">';
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=1'.$param.'">';
$enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
$enabledisablehtml .= '</a>';
}
else
{
// Button on, click to disable
$enabledisablehtml .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=0'.$param.'">';
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=0'.$param.'">';
$enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
$enabledisablehtml .= '</a>';
}

View File

@ -83,7 +83,7 @@ if ($action == 'update')
{
dolibarr_set_const($db, "MAIN_LANG_DEFAULT", $_POST["MAIN_LANG_DEFAULT"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV+1, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["MAIN_MULTILANGS"], 'chaine', 0, '', $conf->entity);
//dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["MAIN_MULTILANGS"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"], 'chaine', 0, '', $conf->entity);
@ -241,13 +241,15 @@ print '</tr>';
// Default language
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultLanguage").'</td><td>';
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, 0, 0, 0, 0, 'minwidth300', 2);
print '<input class="button" type="submit" name="submit" value="'.$langs->trans("Save").'">';
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// Multilingual GUI
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("EnableMultilangInterface").'</td><td>';
print $form->selectyesno('MAIN_MULTILANGS', $conf->global->MAIN_MULTILANGS, 1);
//print $form->selectyesno('MAIN_MULTILANGS', $conf->global->MAIN_MULTILANGS, 1);
print ajax_constantonoff('MAIN_MULTILANGS');
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';

View File

@ -208,14 +208,14 @@ $enabledisablehtml .= $langs->trans("EnableOverwriteTranslation").' ';
if (empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
{
// Button off, click to enable
$enabledisablehtml .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_OVERWRITE_TRANSLATION&value=1'.$param.'">';
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_OVERWRITE_TRANSLATION&value=1'.$param.'">';
$enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
$enabledisablehtml .= '</a>';
}
else
{
// Button on, click to disable
$enabledisablehtml .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_OVERWRITE_TRANSLATION&value=0'.$param.'">';
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_OVERWRITE_TRANSLATION&value=0'.$param.'">';
$enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
$enabledisablehtml .= '</a>';
}

View File

@ -1721,6 +1721,13 @@ class ActionComm extends CommonObject
}
$diff++;
}
$parameters=array('filters' => $filters, 'eventarray' => &$eventarray);
$reshook=$hookmanager->executeHooks('addMoreEventsExport', $parameters); // Note that $action and $object may have been modified by hook
if ($reshook > 0)
{
$eventarray = $hookmanager->resArray;
}
}
else
{

View File

@ -36,3 +36,24 @@
ALTER TABLE llx_bookmark DROP INDEX uk_bookmark_url;
ALTER TABLE llx_bookmark MODIFY COLUMN url TEXT; -- change from VARCHAR(255) to allow longer URLs
ALTER TABLE llx_bookmark ADD UNIQUE uk_bookmark_title (fk_user, title);
ALTER TABLE llx_societe_rib ADD COLUMN stripe_account varchar(128);
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;
ALTER TABLE llx_object_lang ADD UNIQUE INDEX uk_object_lang (fk_object, type_object, property, lang);

View File

@ -0,0 +1,20 @@
-- ============================================================================
-- Copyright (C) 2019 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- 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 <https://www.gnu.org/licenses/>.
--
-- ============================================================================
ALTER TABLE llx_object_lang ADD UNIQUE INDEX uk_object_lang (fk_object, type_object, property, lang);

View File

@ -0,0 +1,31 @@
-- ============================================================================
-- Copyright (C) 2019 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- 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 <https://www.gnu.org/licenses/>.
--
-- ============================================================================
-- 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;

View File

@ -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),

View File

@ -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

View File

@ -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),

View File

@ -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 '<tr><td class="titlefield">';
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 '</td><td>';
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 ' <a href="'.$url.'" target="_stripe">'.img_picto($langs->trans('ShowInStripe'), 'globe').'</a>';
print ' <a href="'.$url.'" target="_stripe">'.img_picto($langs->trans('ShowInStripe').' - Publishable key '.$site_account, 'globe').'</a>';
}
print '</td><td class="right">';
if (empty($stripecu))
@ -913,7 +913,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
{
$url = 'https://dashboard.stripe.com/connect/accounts/'.$stripesupplieracc;
}
print ' <a href="'.$url.'" target="_stripe">'.img_picto($langs->trans('ShowInStripe'), 'globe').'</a>';
print ' <a href="'.$url.'" target="_stripe">'.img_picto($langs->trans('ShowInStripe').' - Publishable key '.$site_account, 'globe').'</a>';
}
print '</td><td class="right">';
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 ' <a href="'.$url.'" target="_stripe">'.img_picto($langs->trans('ShowInStripe'), 'globe').'</a>';
print ' <a href="'.$url.'" target="_stripe">'.img_picto($langs->trans('ShowInStripe').' - Publishable key '.$companypaymentmodetemp->stripe_account, 'globe').'</a>';
}
print '</td>';
print '<td>';

View File

@ -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 '<td colspan="2">';
print $form->selectyesno("TAKEPOS_PHONE_BASIC_LAYOUT", $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT, 1);
print '</td></tr>';
print '<tr class="oddeven value"><td>';
print $langs->trans("ProductSupplements");
print '<td colspan="2">';
print $form->selectyesno("TAKEPOS_SUPPLEMENTS", $conf->global->TAKEPOS_SUPPLEMENTS, 1);
print '</td></tr>';
if ($conf->global->TAKEPOS_SUPPLEMENTS)
{
print '<tr class="oddeven"><td>';
print $langs->trans("SupplementCategory");
print '<td colspan="2">';
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 "</td></tr>\n";
}
}
print '<tr class="oddeven"><td>';

View File

@ -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)
{

View File

@ -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].='<tr class="drag drop oddeven posinvoiceline';
if ($line->special_code == "4") $htmlsupplements[$line->fk_parent_line].=' order';
$htmlsupplements[$line->fk_parent_line].= '" id="'.$line->id.'">';
$htmlsupplements[$line->fk_parent_line].= '<td class="left">';
$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] .= '<br>';
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] .= '</td>';
if ($_SESSION["basiclayout"] != 1)
{
$htmlsupplements[$line->fk_parent_line] .= '<td class="right">'.vatrate($line->remise_percent, true).'</td>';
$htmlsupplements[$line->fk_parent_line] .= '<td class="right">'.$line->qty.'</td>';
$htmlsupplements[$line->fk_parent_line] .= '<td class="right">'.price($line->total_ttc).'</td>';
}
$htmlsupplements[$line->fk_parent_line] .= '</tr>'."\n";
continue;
}
$htmlforlines = '';
$htmlforlines .= '<tr class="drag drop oddeven posinvoiceline';
@ -726,6 +774,7 @@ if ($placeid > 0)
$htmlforlines .= '<td class="right">'.price($line->total_ttc).'</td>';
}
$htmlforlines .= '</tr>'."\n";
$htmlforlines .= $htmlsupplements[$line->id];
print $htmlforlines;
}

View File

@ -233,10 +233,14 @@ function LoadProducts(position, issubcat) {
console.log("LoadProducts");
var maxproduct = <?php echo ($MAXPRODUCT - 2); ?>;
$('#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'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("OrderNotes").'</div>', 'action'=>'TakeposOrderNotes();');
}
if ($conf->global->TAKEPOS_SUPPLEMENTS)
{
$menus[$r++]=array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("ProductSupplements").'</div>', 'action'=>'LoadProducts(\'supplements\');');
}
}
if ($conf->global->TAKEPOSCONNECTOR) {