Merge branch 'develop' into 12.0_a1

This commit is contained in:
Alexandre SPANGARO 2019-12-31 06:48:04 +01:00
commit 1f282ad0e4
10 changed files with 89 additions and 13 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

@ -68,3 +68,24 @@ DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 74;
DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 82;
DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 83;
DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 91;
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

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

@ -246,8 +246,8 @@ class Stripe extends CommonObject
}
// Create customer in Dolibarr
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_account (fk_soc, login, key_account, site, status, entity, date_creation, fk_user_creat)";
$sql .= " VALUES (".$object->id.", '', '".$this->db->escape($customer->id)."', 'stripe', ".$status.", ".$conf->entity.", '".$this->db->idate(dol_now())."', ".$user->id.")";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_account (fk_soc, login, key_account, site, site_account, status, entity, date_creation, fk_user_creat)";
$sql .= " VALUES (".$object->id.", '', '".$this->db->escape($customer->id)."', 'stripe', '".$this->db->escape($stripearrayofkeysbyenv[$status]['publishable_key'])."', ".$status.", ".$conf->entity.", '".$this->db->idate(dol_now())."', ".$user->id.")";
$resql = $this->db->query($sql);
if (!$resql)
{