Merge remote-tracking branch 'refs/remotes/Dolibarr/develop' into develop

This commit is contained in:
Darkjeff 2017-07-03 06:19:16 +02:00
commit 535bd4dcb8
11 changed files with 210 additions and 125 deletions

View File

@ -857,6 +857,7 @@ class DoliDBMysqli extends DoliDB
* Return charset used to store data in current database (same result than using SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = "databasename";) * Return charset used to store data in current database (same result than using SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = "databasename";)
* *
* @return string Charset * @return string Charset
* @see getDefaultCollationDatabase
*/ */
function getDefaultCharacterSetDatabase() function getDefaultCharacterSetDatabase()
{ {
@ -867,7 +868,9 @@ class DoliDBMysqli extends DoliDB
return $this->forcecharset; return $this->forcecharset;
} }
$liste=$this->fetch_array($resql); $liste=$this->fetch_array($resql);
return $liste['Value']; $tmpval = $liste['Value'];
return $tmpval;
} }
/** /**
@ -900,6 +903,7 @@ class DoliDBMysqli extends DoliDB
* Return collation used in current database * Return collation used in current database
* *
* @return string Collation value * @return string Collation value
* @see getDefaultCharacterSetDatabase
*/ */
function getDefaultCollationDatabase() function getDefaultCollationDatabase()
{ {
@ -910,7 +914,9 @@ class DoliDBMysqli extends DoliDB
return $this->forcecollate; return $this->forcecollate;
} }
$liste=$this->fetch_array($resql); $liste=$this->fetch_array($resql);
return $liste['Value']; $tmpval = $liste['Value'];
return $tmpval;
} }
/** /**

View File

@ -25,7 +25,22 @@
-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
ALTER TABLE llx_supplier_proposaldet CHANGE COLUMN fk_askpricesupplier fk_supplier_proposal integer NOT NULL;
-- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES';
-- VMYSQL4.1 update llx_adherent set datefin = NULL where DATE(STR_TO_DATE(datefin, '%Y-%m-%d')) IS NULL;
-- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE';
-- VMYSQL4.1 update llx_adherent set datefin = NULL where DATE(STR_TO_DATE(datefin, '%Y-%m-%d')) IS NULL;
-- VMYSQL4.1 ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN tms timestamp DEFAULT '2001-01-01 00:00:00'; -- VMYSQL4.1 ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN tms timestamp DEFAULT '2001-01-01 00:00:00';
-- VMYSQL4.1 ALTER TABLE llx_adherent MODIFY COLUMN datefin datetime NULL;
-- To remove a default value for date that is not valid when field is not null
-- VMYSQL4.1 ALTER TABLE llx_chargesociales MODIFY COLUMN date_ech datetime DEFAULT NULL;
-- VMYSQL4.1 ALTER TABLE llx_chargesociales MODIFY COLUMN date_ech datetime NOT NULL;
-- Clean corrupted values for tms -- Clean corrupted values for tms
-- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; -- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES';
@ -331,6 +346,8 @@ ALTER TABLE llx_product_fournisseur_price_log ADD COLUMN multicurrency_tx d
ALTER TABLE llx_product_fournisseur_price_log ADD COLUMN multicurrency_price double(24,8) DEFAULT NULL; ALTER TABLE llx_product_fournisseur_price_log ADD COLUMN multicurrency_price double(24,8) DEFAULT NULL;
ALTER TABLE llx_product_fournisseur_price_log ADD COLUMN multicurrency_price_ttc double(24,8) DEFAULT NULL; ALTER TABLE llx_product_fournisseur_price_log ADD COLUMN multicurrency_price_ttc double(24,8) DEFAULT NULL;
UPDATE TABLE llx_contrat set ref = rowid where ref is null or ref = '';
create table llx_payment_various create table llx_payment_various
( (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
@ -501,7 +518,7 @@ CREATE TABLE llx_blockedlog_authority
ALTER TABLE llx_blockedlog_authority ADD INDEX signature (signature); ALTER TABLE llx_blockedlog_authority ADD INDEX signature (signature);
-- VMYSQL4.1 INSERT IGNORE INTO llx_product_lot (entity, fk_product, batch, eatby, sellby, datec, fk_user_creat, fk_user_modif) SELECT DISTINCT e.entity, ps.fk_product, pb.batch, pb.eatby, pb.sellby, pb.tms, e.fk_user_author, e.fk_user_author from llx_product_batch as pb, llx_product_stock as ps, llx_entrepot as e WHERE pb.fk_product_stock = ps.rowid AND ps.fk_entrepot = e.rowid -- VMYSQL4.1 INSERT IGNORE INTO llx_product_lot (entity, fk_product, batch, eatby, sellby, datec, fk_user_creat, fk_user_modif) SELECT DISTINCT e.entity, ps.fk_product, pb.batch, pb.eatby, pb.sellby, pb.tms, e.fk_user_author, e.fk_user_author from llx_product_batch as pb, llx_product_stock as ps, llx_entrepot as e WHERE pb.fk_product_stock = ps.rowid AND ps.fk_entrepot = e.rowid;
UPDATE llx_bank SET label= '(SupplierInvoicePayment)' WHERE label= 'Règlement fournisseur'; UPDATE llx_bank SET label= '(SupplierInvoicePayment)' WHERE label= 'Règlement fournisseur';
UPDATE llx_bank SET label= '(CustomerInvoicePayment)' WHERE label= 'Règlement client'; UPDATE llx_bank SET label= '(CustomerInvoicePayment)' WHERE label= 'Règlement client';

View File

@ -13,12 +13,17 @@
-- flush privileges; -- flush privileges;
-- Requests to change character set and collation of a varchar column. -- Request to change default pagecode + colation of database
-- utf8 and utf8_unicode_ci is recommended (or even better utf8mb4 and utf8mb4_unicode_ci with mysql 5.5.3+) -- ALTER DATABASE name_of_database CHARACTER SET utf8 COLLATE utf8_unicode_ci;
-- Request to change default pagecode + colation of table
-- ALTER TABLE name_of_table CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
-- Request to change character set and collation of a varchar column.
-- utf8 and utf8_unicode_ci is recommended (or even better utf8mb4 and utf8mb4_unicode_ci with mysql 5.5.3+)
-- ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) CHARACTER SET utf8; -- ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) CHARACTER SET utf8;
-- ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) COLLATE utf8_unicode_ci; -- ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) COLLATE utf8_unicode_ci;
-- You can check with 'show full columns from llx_accounting_account'; -- You can check with 'show full columns from mytablename';

View File

@ -16,4 +16,5 @@
-- --
-- ============================================================================ -- ============================================================================
ALTER TABLE llx_product_attribute ADD CONSTRAINT unique_ref UNIQUE (ref); ALTER TABLE llx_product_attribute ADD UNIQUE INDEX uk_product_attribute_ref (ref);

View File

@ -78,6 +78,7 @@ print 'Option clean_product_stock_batch (0 or \'test\' or \'confirmed\') is '.(G
print 'Option set_empty_time_spent_amount (0 or \'test\' or \'confirmed\') is '.(GETPOST('set_empty_time_spent_amount','alpha')?GETPOST('set_empty_time_spent_amount','alpha'):'0').'<br>'."\n"; print 'Option set_empty_time_spent_amount (0 or \'test\' or \'confirmed\') is '.(GETPOST('set_empty_time_spent_amount','alpha')?GETPOST('set_empty_time_spent_amount','alpha'):'0').'<br>'."\n";
print 'Option rebuild_product_thumbs (0 or \'test\' or \'confirmed\') is '.(GETPOST('rebuild_product_thumbs','alpha')?GETPOST('rebuild_product_thumbs','alpha'):'0').'<br>'."\n"; print 'Option rebuild_product_thumbs (0 or \'test\' or \'confirmed\') is '.(GETPOST('rebuild_product_thumbs','alpha')?GETPOST('rebuild_product_thumbs','alpha'):'0').'<br>'."\n";
print 'Option force_disable_of_modules_not_found (0 or \'test\' or \'confirmed\') is '.(GETPOST('force_disable_of_modules_not_found','alpha')?GETPOST('force_disable_of_modules_not_found','alpha'):'0').'<br>'."\n"; print 'Option force_disable_of_modules_not_found (0 or \'test\' or \'confirmed\') is '.(GETPOST('force_disable_of_modules_not_found','alpha')?GETPOST('force_disable_of_modules_not_found','alpha'):'0').'<br>'."\n";
print 'Option force_utf8_on_tables, for mysql/mariadb only(0 or \'test\' or \'confirmed\') is '.(GETPOST('force_utf8_on_tables','alpha')?GETPOST('force_utf8_on_tables','alpha'):'0').'<br>'."\n";
print '<br>'; print '<br>';
print '<table cellspacing="0" cellpadding="1" border="0" width="100%">'; print '<table cellspacing="0" cellpadding="1" border="0" width="100%">';
@ -890,6 +891,35 @@ if ($ok && GETPOST('force_disable_of_modules_not_found','alpha'))
// clean_old_module_entries: Clean data into const when files of module were removed without being
// clean_linked_elements: Check and clean linked elements
if ($ok && GETPOST('force_utf8_on_tables','alpha'))
{
print '<tr><td colspan="2"><br>*** Force page code and collation with utf8 (for mysql/mariadb only)</td></tr>';
if ($db->type == "mysql")
{
$listoftables = $db->DDLListTables($db->database_name);
foreach($listoftables as $table)
{
print '<tr><td colspan="2">';
print $table;
$sql='ALTER TABLE '.$table.' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci';
if (GETPOST('force_utf8_on_tables','alpha') == 'confirmed')
{
$db->query($sql);
}
print '</td></tr>';
}
}
else
{
print '<tr><td colspan="2">Not available with database type '.$db->type.'</td></tr>';
}
}
print '</table>'; print '</table>';

View File

@ -312,7 +312,10 @@ if (! $error && $db->connected)
// Define $defaultCharacterSet and $defaultDBSortingCollation // Define $defaultCharacterSet and $defaultDBSortingCollation
if (! $error && $db->connected) if (! $error && $db->connected)
{ {
if (!empty($db_create_database)) { // If we create database, we force default value if (!empty($db_create_database)) // If we create database, we force default value
{
// Default values come from the database handler
$defaultCharacterSet=$db->forcecharset; $defaultCharacterSet=$db->forcecharset;
$defaultDBSortingCollation=$db->forcecollate; $defaultDBSortingCollation=$db->forcecollate;
} }
@ -322,6 +325,14 @@ if (! $error && $db->connected)
$defaultDBSortingCollation=$db->getDefaultCollationDatabase(); $defaultDBSortingCollation=$db->getDefaultCollationDatabase();
} }
// Force to avoid utf8mb4 because index on field char 255 reach limit of 767 char for indexes (example with mysql 5.6.34 = mariadb 10.0.29)
// TODO Remove this when utf8mb4 is supported
if ($defaultCharacterSet == 'utf8mb4' || $defaultDBSortingCollation == 'utf8mb4_unicode_ci')
{
$defaultCharacterSet = 'utf8';
$defaultDBSortingCollation = 'utf8_unicode_ci';
}
print '<input type="hidden" name="dolibarr_main_db_character_set" value="'.$defaultCharacterSet.'">'; print '<input type="hidden" name="dolibarr_main_db_character_set" value="'.$defaultCharacterSet.'">';
print '<input type="hidden" name="dolibarr_main_db_collation" value="'.$defaultDBSortingCollation.'">'; print '<input type="hidden" name="dolibarr_main_db_collation" value="'.$defaultDBSortingCollation.'">';
$db_character_set=$defaultCharacterSet; $db_character_set=$defaultCharacterSet;

View File

@ -25,4 +25,5 @@ RealURL=Real URL
ViewWebsiteInProduction=View web site using home URLs ViewWebsiteInProduction=View web site using home URLs
SetHereVirtualHost=If you can set, on your web server, a dedicated virtual host with a root directory on <strong>%s</strong>, define here the virtual hostname so the preview can be done also using this direct web server access and not only using Dolibarr server. SetHereVirtualHost=If you can set, on your web server, a dedicated virtual host with a root directory on <strong>%s</strong>, define here the virtual hostname so the preview can be done also using this direct web server access and not only using Dolibarr server.
PreviewSiteServedByWebServer=Preview %s in a new tab.<br><br>The %s will be served by an external web server (like Apache, Nginx, IIS). You must install and setup this server before to point to directory:<br><strong>%s</strong><br>URL served by external server:<br><strong>%s</strong> PreviewSiteServedByWebServer=Preview %s in a new tab.<br><br>The %s will be served by an external web server (like Apache, Nginx, IIS). You must install and setup this server before to point to directory:<br><strong>%s</strong><br>URL served by external server:<br><strong>%s</strong>
PreviewSiteServedByDolibarr=Preview %s in a new tab.<br><br>The %s will be served by Dolibarr server so it does not need any extra web server (like Apache, Nginx, IIS) to be installed.<br>The inconvenient is that URL of pages are not user friendly and start with path of your Dolibarr.<br>URL served by Dolibarr:<br><strong>%s</strong><br><br>To use your own external web server to serve this web site, create a virtual host on your web server that point on directory<br><strong>%s</strong><br>then enter the name of this virtual server and clicking on the other preview button. PreviewSiteServedByDolibarr=Preview %s in a new tab.<br><br>The %s will be served by Dolibarr server so it does not need any extra web server (like Apache, Nginx, IIS) to be installed.<br>The inconvenient is that URL of pages are not user friendly and start with path of your Dolibarr.<br>URL served by Dolibarr:<br><strong>%s</strong><br><br>To use your own external web server to serve this web site, create a virtual host on your web server that point on directory<br><strong>%s</strong><br>then enter the name of this virtual server and click on the other preview button.
NoPageYet=No pages yet

View File

@ -297,7 +297,7 @@ if ($action == 'charge')
} }
$_SESSION["onlinetoken"] = $stripeToken; $_SESSION["onlinetoken"] = $stripeToken;
$_SESSION["FinalPaymentAmt"] = $amount; $_SESSION["Payment_Amount"] = $amount;
$_SESSION["currencyCodeType"] = $currency; $_SESSION["currencyCodeType"] = $currency;
$_SESSION["paymentType"] = ''; $_SESSION["paymentType"] = '';
$_SESSION['ipaddress'] = $_SERVER['REMOTE_ADDR']; // Payer ip $_SESSION['ipaddress'] = $_SERVER['REMOTE_ADDR']; // Payer ip

View File

@ -12,9 +12,10 @@ if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't ne
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library
if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session) if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
// If you don't need session management (can't be logged if no session used). You must also set // If you don't need session management (can't be logged if no session used). You must also set
// NOCSRFCHECK, NOTOKENRENEWAL, NOLOGIN, // NOCSRFCHECK, NOTOKENRENEWAL, NOLOGIN
// Disable module with GETPOST('disablemodules') won't work. Variable 'dol_...' will not be set. // Disable module with GETPOST('disablemodules') won't work. Variable 'dol_...' will not be set.
// $_SESSION are then simple vars if sessions are not active. // $_SESSION are then simple vars if sessions are not active.
// TODO We can close session with session_write_close() as soon as we just need read access.
if (! defined("NOSESSION")) define("NOSESSION",'1'); if (! defined("NOSESSION")) define("NOSESSION",'1');
define('REQUIRE_JQUERY_MULTISELECT','select2'); define('REQUIRE_JQUERY_MULTISELECT','select2');

View File

@ -193,7 +193,6 @@ class WebsitePage extends CommonObject
$sql = 'SELECT'; $sql = 'SELECT';
$sql .= ' t.rowid,'; $sql .= ' t.rowid,';
$sql .= " t.fk_website,"; $sql .= " t.fk_website,";
$sql .= " t.pageurl,"; $sql .= " t.pageurl,";
$sql .= " t.title,"; $sql .= " t.title,";
@ -203,7 +202,6 @@ class WebsitePage extends CommonObject
$sql .= " t.status,"; $sql .= " t.status,";
$sql .= " t.date_creation,"; $sql .= " t.date_creation,";
$sql .= " t.tms as date_modification"; $sql .= " t.tms as date_modification";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
//$sql .= ' WHERE entity IN ('.getEntity('website').')'; // entity is on website level //$sql .= ' WHERE entity IN ('.getEntity('website').')'; // entity is on website level
$sql .= ' WHERE 1 = 1'; $sql .= ' WHERE 1 = 1';

View File

@ -160,10 +160,17 @@ if ($action == 'add')
$objectpage->description = GETPOST('WEBSITE_DESCRIPTION'); $objectpage->description = GETPOST('WEBSITE_DESCRIPTION');
$objectpage->keywords = GETPOST('WEBSITE_KEYWORD'); $objectpage->keywords = GETPOST('WEBSITE_KEYWORD');
if (empty($objectpage->title)) if (empty($objectpage->pageurl))
{ {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("WEBSITE_PAGENAME")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("WEBSITE_PAGENAME")), null, 'errors');
$error++; $error++;
$action='create';
}
if (empty($objectpage->title))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("WEBSITE_TITLE")), null, 'errors');
$error++;
$action='create';
} }
if (! $error) if (! $error)
@ -186,9 +193,12 @@ if ($action == 'add')
$db->rollback(); $db->rollback();
} }
if (! $error)
{
$action = 'preview'; $action = 'preview';
$id = $objectpage->id; $id = $objectpage->id;
} }
}
// Update page // Update page
if ($action == 'delete') if ($action == 'delete')
@ -456,12 +466,17 @@ if ($action == 'updatecontent' || GETPOST('refreshsite') || GETPOST('refreshpage
} }
else else
{ {
$res = $objectpage->fetch($object->fk_default_home); $res=0;
if (! $res > 0) if ($object->fk_default_home > 0)
{ {
$res = $objectpage->fetch(0, $object->fk_website); $res = $objectpage->fetch($object->fk_default_home);
}
if (! ($res > 0))
{
$res = $objectpage->fetch(0, $object->id);
} }
} }
if ($res > 0) if ($res > 0)
{ {
if ($action == 'updatecontent') if ($action == 'updatecontent')
@ -586,7 +601,7 @@ if ($action == 'updatecontent' || GETPOST('refreshsite') || GETPOST('refreshpage
} }
else else
{ {
dol_print_error($db, 'Page not found'); setEventMessages($langs->trans("NoPageYet"), null, 'warnings');
} }
} }