2
0
forked from Wavyzz/dolibarr

Merge branch 'develop' into patch-187

This commit is contained in:
ptibogxiv
2019-09-10 20:46:54 +02:00
committed by GitHub
4164 changed files with 106386 additions and 46060 deletions

View File

@@ -127,7 +127,7 @@ if (! function_exists("imagecreate"))
{
$langs->load("errors");
print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportGD")."<br>\n";
// $checksok=0; // If image ko, just warning. So check must still be 1 (otherwise no way to install)
// $checksok=0; // If ko, just warning. So check must still be 1 (otherwise no way to install)
}
else
{
@@ -140,7 +140,7 @@ if (! function_exists("curl_init"))
{
$langs->load("errors");
print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportCurl")."<br>\n";
// $checksok=0; // If image ko, just warning. So check must still be 1 (otherwise no way to install)
// $checksok=0; // If ko, just warning. So check must still be 1 (otherwise no way to install)
}
else
{
@@ -153,7 +153,7 @@ if (! function_exists("utf8_encode"))
{
$langs->load("errors");
print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportUTF8")."<br>\n";
// $checksok=0; // If image ko, just warning. So check must still be 1 (otherwise no way to install)
// $checksok=0; // If ko, just warning. So check must still be 1 (otherwise no way to install)
}
else
{
@@ -161,18 +161,20 @@ else
}
// Check if UTF8 supported
if (! function_exists("locale_get_primary_language"))
// Check if intl methods are supported
if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@localhost')
{
$langs->load("errors");
print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportIntl")."<br>\n";
// $checksok=0; // If image ko, just warning. So check must still be 1 (otherwise no way to install)
if (! function_exists("locale_get_primary_language") || ! function_exists("locale_get_region"))
{
$langs->load("errors");
print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportIntl")."<br>\n";
// $checksok=0; // If ko, just warning. So check must still be 1 (otherwise no way to install)
}
else
{
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupportIntl")."<br>\n";
}
}
else
{
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupportIntl")."<br>\n";
}
// Check memory
@@ -451,7 +453,8 @@ else
array('from'=>'6.0.0', 'to'=>'7.0.0'),
array('from'=>'7.0.0', 'to'=>'8.0.0'),
array('from'=>'8.0.0', 'to'=>'9.0.0'),
array('from'=>'9.0.0', 'to'=>'10.0.0')
array('from'=>'9.0.0', 'to'=>'10.0.0'),
array('from'=>'10.0.0', 'to'=>'11.0.0')
);
$count=0;

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

View File

@@ -253,35 +253,11 @@ foreach ($handlers as $handler)
if (empty($conf->loghandlers[$handler])) $conf->loghandlers[$handler]=$loghandlerinstance;
}
// Removed magic_quotes
if (function_exists('get_magic_quotes_gpc')) // magic_quotes_* removed in PHP 5.4
{
if (get_magic_quotes_gpc())
{
// Forcing parameter setting magic_quotes_gpc and cleaning parameters
// (Otherwise he would have for each position, condition
// Reading stripslashes variable according to state get_magic_quotes_gpc).
// Off mode (recommended, you just do $db->escape when an insert / update.
function stripslashes_deep($value)
{
return (is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value));
}
$_GET = array_map('stripslashes_deep', $_GET);
$_POST = array_map('stripslashes_deep', $_POST);
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
$_REQUEST = array_map('stripslashes_deep', $_REQUEST);
@set_magic_quotes_runtime(0);
}
}
// Defini objet langs
// Define object $langs
$langs = new Translate('..', $conf);
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09'));
else $langs->setDefaultLang('auto');
$bc[false]=' class="bg1"';
$bc[true]=' class="bg2"';
/**
* Load conf file (file must exists)
@@ -433,7 +409,9 @@ function pHeader($subtitle, $next, $action = 'set', $param = '', $forcejqueryurl
}
print '</span>'."\n";
print '<form name="forminstall" style="width: 100%" action="'.$next.'.php'.($param?'?'.$param:'').'" method="POST">'."\n";
print '<form name="forminstall" style="width: 100%" action="'.$next.'.php'.($param?'?'.$param:'').'" method="POST"';
if ($next == 'step5') print ' autocomplete="off"';
print '>'."\n";
print '<input type="hidden" name="testpost" value="ok">'."\n";
print '<input type="hidden" name="action" value="'.$action.'">'."\n";

View File

@@ -102,9 +102,9 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_VALIDATE','Expense report validated','Executed when an expense report is validated','expensereport',202);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_APPROVE','Expense report approved','Executed when an expense report is approved','expensereport',203);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_PAYED','Expense report billed','Executed when an expense report is set as billed','expensereport',204);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_DELETE','Expense report deleted','Executed when an expense report is deleted','expensereport',204);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_VALIDATE','Expense report validated','Executed when an expense report is validated','expensereport',202);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_APPROVE','Expense report approved','Executed when an expense report is approved','expensereport',203);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_DELETE','Expense report deleted','Executed when an expense report is deleted','expensereport',205);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_VALIDATE','Expense report validated','Executed when an expense report is validated','expensereport',211);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_APPROVE','Expense report approved','Executed when an expense report is approved','expensereport',212);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_VALIDATE','Project validation','Executed when a project is validated','project',141);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_DELETE','Project deleted','Executed when a project is deleted','project',143);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_CREATE','Ticket created','Executed when a ticket is created','ticket',161);
@@ -116,7 +116,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
-- actions not enabled by default (no constant created for that) when we enable module agenda
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_MODIFY','Product or service modified','Executed when a product or sevice is modified','product',41);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_MODIFY','Member modified','Executed when a member is modified','member',23);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_MODIFY','Intervention modified','Executed when a intervention is modified','ficheinter',31);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_MODIFY','Intervention modified','Executed when a intervention is modified','ficheinter',19);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_CREATE','Project creation','Executed when a project is created','project',140);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_MODIFY','Project modified','Executed when a project is modified','project',142);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_CREATE','Task created','Executed when a project task is created','project',150);

View File

@@ -24,7 +24,7 @@ INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_u
INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingEmailOnAutoSubscription)' ,10,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipRequestWasReceived)__','__(Hello)__ __MEMBER_FULLNAME__,<br><br>\n\n__(ThisIsContentOfYourMembershipRequestWasReceived)__<br>\n<br>__ONLINE_PAYMENT_TEXT_AND_URL__<br>\n<br><br>\n__(Sincerely)__<br>__USER_SIGNATURE__',null, 0);
INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingEmailOnMemberValidation)' ,20,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipWasValidated)__', '__(Hello)__ __MEMBER_FULLNAME__,<br><br>\n\n__(ThisIsContentOfYourMembershipWasValidated)__<br>__INFOS__<br>\n<br>__ONLINE_PAYMENT_TEXT_AND_URL__<br>\n<br><br>\n__(Sincerely)__<br>__USER_SIGNATURE__',null, 0);
INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingEmailOnMemberValidation)' ,20,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipWasValidated)__', '__(Hello)__ __MEMBER_FULLNAME__,<br><br>\n\n__(ThisIsContentOfYourMembershipWasValidated)__<br>__(FirstName)__ : __MEMBER_FIRSTNAME__<br>__(LastName)__ : __MEMBER_LASTNAME__<br>__(ID)__ : __MEMBER_ID__<br>\n<br>__ONLINE_PAYMENT_TEXT_AND_URL__<br>\n<br><br>\n__(Sincerely)__<br>__USER_SIGNATURE__',null, 0);
INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingEmailOnNewSubscription)' ,30,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourSubscriptionWasRecorded)__', '__(Hello)__ __MEMBER_FULLNAME__,<br><br>\n\n__(ThisIsContentOfYourSubscriptionWasRecorded)__<br>\n\n<br><br>\n__(Sincerely)__<br>__USER_SIGNATURE__',null, 1);
INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingReminderForExpiredSubscription)',40,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(SubscriptionReminderEmail)__', '__(Hello)__ __MEMBER_FULLNAME__,<br><br>\n\n__(ThisIsContentOfSubscriptionReminderEmail)__<br>\n<br>__ONLINE_PAYMENT_TEXT_AND_URL__<br>\n<br><br>\n__(Sincerely)__<br>__USER_SIGNATURE__',null, 0);
INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingEmailOnCancelation)' ,50,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipWasCanceled)__', '__(Hello)__ __MEMBER_FULLNAME__,<br><br>\n\n__(YourMembershipWasCanceled)__<br>\n<br><br>\n__(Sincerely)__<br>__USER_SIGNATURE__',null, 0);

View File

@@ -0,0 +1,82 @@
-- Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
-- Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
-- Copyright (C) 2004 Guillaume Delecourt <guillaume.delecourt@opensides.be>
-- Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
-- Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
-- Copyright (C) 2019 Markus Welters <markus@welters.de>
--
-- 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 <http://www.gnu.org/licenses/>.
--
--
-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors
-- de l'install et tous les sigles '--' sont supprimés.
--
-- LIST ON https://fr.wikipedia.org/wiki/Jour_férié
-- A lot of countries
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('NEWYEARDAY1', 0, 0, 0, 1, 1, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('LABORDAY1', 0, 0, 0, 5, 1, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('ASSOMPTIONDAY1', 0, 0, 0, 8, 15, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('CHRISTMASDAY1', 0, 0, 0, 12, 25, 1);
-- France only (1)
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('FR-VICTORYDAY', 0, 1, '', 0, 5, 8, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('FR-NATIONALDAY', 0, 1, '', 0, 7, 14, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('FR-ASSOMPTION', 0, 1, '', 0, 8, 15, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('FR-TOUSSAINT', 0, 1, '', 0, 11, 1, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('FR-ARMISTICE', 0, 1, '', 0, 11, 11, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('FR-EASTER', 0, 1, 'eastermonday', 0, 0, 0, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('FR-ASCENSION', 0, 1, 'ascension', 0, 0, 0, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('FR-PENTECOST', 0, 1, 'pentecost', 0, 0, 0, 1);
-- Italy (3)
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('IT-LIBEAZIONE', 0, 3, 0, 4, 25, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('IT-EPIPHANY', 0, 3, 0, 6, 1, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('IT-REPUBBLICA', 0, 3, 0, 6, 2, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('IT-TUTTISANTIT', 0, 3, 0, 11, 1, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('IT-IMMACULE', 0, 3, 0, 12, 8, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('IT-SAINTSTEFAN', 0, 3, 0, 12, 26, 1);
-- Spain (4)
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('ES-EASTER', 0, 4, 'easter', 0, 0, 0, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('ES-REYE', 0, 4, '', 0, 6, 1, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('ES-HISPANIDAD', 0, 4, '', 0, 10, 12, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('ES-TOUSSAINT', 0, 4, '', 0, 11, 1, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('ES-CONSTITUIZION', 0, 4, '', 0, 12, 6, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('ES-IMMACULE', 0, 4, '', 0, 12, 8, 1);
-- Austria (41)
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-EASTER', 0, 41, 'eastermonday', 0, 0, 0, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-ASCENSION', 0, 41, 'ascension', 0, 0, 0, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-PENTECOST', 0, 41, 'pentecost', 0, 0, 0, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-FRONLEICHNAM', 0, 41, 'fronleichnam', 0, 0, 0, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-KONEGIE', 0, 41, '', 0, 6, 1, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-26OKT', 0, 41, '', 0, 10, 26, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-TOUSSAINT', 0, 41, '', 0, 11, 1, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-IMMACULE', 0, 41, '', 0, 12 8, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-24DEC', 0, 41, '', 0, 12, 24, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-SAINTSTEFAN', 0, 41, '', 0, 12, 26, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-Silvester', 0, 41, '', 0, 12, 31, 1);
-- India (117)
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('IN-REPUBLICDAY', 0, 117, '', 0, 1, 26, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('IN-GANDI', 0, 117, '', 0, 10, 2, 1);

View File

@@ -128,12 +128,6 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (11
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1162, 116, '7','0','VAT reduced rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1163, 116, '0','0','VAT rate 0',1);
-- ITALY (id country=3)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 31, 3, '22','0','VAT standard rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 32, 3, '10','0','VAT reduced rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 33, 3, '4','0','VAT super-reduced rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 34, 3, '0','0','VAT Rate 0',1);
-- INDIA (id country=117)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1171, 117, '0','0','VAT Rate 0', 0);
@@ -153,6 +147,12 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 8
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 84, 8, '9','0','VAT reduced rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 85, 8, '4.8','0','VAT reduced rate',1);
-- ITALY (id country=3)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 31, 3, '22','0','VAT standard rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 32, 3, '10','0','VAT reduced rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 33, 3, '4','0','VAT super-reduced rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 34, 3, '0','0','VAT Rate 0',1);
-- IVORY COST (id country=21)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values (211, 21, '0','0',0,0,0,0,'IVA Rate 0',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values (212, 21, '18','0',7.5,2,0,0,'IVA standard rate',1);

View File

@@ -0,0 +1,166 @@
--
-- Be carefull to requests order.
-- This file must be loaded by calling /install/index.php page
-- when current version is 11.0.0 or higher.
--
-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y
-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y
-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new;
-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol;
-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60);
-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname;
-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60);
-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name;
-- To create a unique index ALTER TABLE llx_table ADD UNIQUE INDEX uk_table_field (field);
-- To drop an index: -- VMYSQL4.1 DROP INDEX nomindex on llx_table
-- To drop an index: -- VPGSQL8.2 DROP INDEX nomindex
-- To make pk to be auto increment (mysql): -- VMYSQL4.3 ALTER TABLE llx_table CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
-- To make pk to be auto increment (postgres):
-- -- VPGSQL8.2 CREATE SEQUENCE llx_table_rowid_seq OWNED BY llx_table.rowid;
-- -- VPGSQL8.2 ALTER TABLE llx_table ADD PRIMARY KEY (rowid);
-- -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN rowid SET DEFAULT nextval('llx_table_rowid_seq');
-- -- VPGSQL8.2 SELECT setval('llx_table_rowid_seq', MAX(rowid)) FROM llx_table;
-- To set a field as NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NULL;
-- To set a field as NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL;
-- To set a field as NOT NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NOT NULL;
-- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL;
-- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL;
-- Note: fields with type BLOB/TEXT can't have default value.
-- Missing in v10
ALTER TABLE llx_account_bookkeeping ADD COLUMN date_export datetime DEFAULT NULL;
ALTER TABLE llx_expensereport ADD COLUMN paid smallint default 0 NOT NULL;
UPDATE llx_expensereport set paid = 1 WHERE fk_statut = 6 and paid = 0;
create table llx_entrepot_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
fk_object integer NOT NULL,
import_key varchar(14) -- import key
) ENGINE=innodb;
ALTER TABLE llx_entrepot_extrafields ADD INDEX idx_entrepot_extrafields (fk_object);
ALTER TABLE llx_facture ADD COLUMN retained_warranty real DEFAULT NULL after situation_final;
ALTER TABLE llx_facture ADD COLUMN retained_warranty_date_limit date DEFAULT NULL after retained_warranty;
ALTER TABLE llx_facture ADD COLUMN retained_warranty_fk_cond_reglement integer DEFAULT NULL after retained_warranty_date_limit;
ALTER TABLE llx_c_shipment_mode ADD COLUMN entity integer DEFAULT 1 NOT NULL;
ALTER TABLE llx_c_shipment_mode DROP INDEX uk_c_shipment_mode;
ALTER TABLE llx_c_shipment_mode ADD UNIQUE INDEX uk_c_shipment_mode (code, entity);
ALTER TABLE llx_facture_fourn DROP COLUMN total;
ALTER TABLE llx_user ADD COLUMN iplastlogin varchar(250);
ALTER TABLE llx_user ADD COLUMN ippreviouslogin varchar(250);
ALTER TABLE llx_events ADD COLUMN prefix_session varchar(255) NULL;
create table llx_payment_salary_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
fk_object integer NOT NULL, -- salary payment id
import_key varchar(14) -- import key
)ENGINE=innodb;
ALTER TABLE llx_payment_salary_extrafields ADD INDEX idx_payment_salary_extrafields (fk_object);
ALTER TABLE llx_c_price_expression MODIFY COLUMN expression varchar(255) NOT NULL;
UPDATE llx_bank_url set url = REPLACE( url, 'compta/salaries/', 'salaries/');
ALTER TABLE llx_stock_mouvement ADD COLUMN fk_projet INTEGER NOT NULL DEFAULT 0 AFTER model_pdf;
ALTER TABLE llx_oauth_token ADD COLUMN fk_soc integer DEFAULT NULL after token;
ALTER TABLE llx_mailing ADD COLUMN tms timestamp;
ALTER TABLE llx_mailing_cibles ADD COLUMN tms timestamp;
ALTER TABLE llx_projet ADD COLUMN usage_opportunity integer DEFAULT 0;
ALTER TABLE llx_projet ADD COLUMN usage_task integer DEFAULT 1;
ALTER TABLE llx_projet CHANGE COLUMN bill_time usage_bill_time integer DEFAULT 0; -- rename existing field
ALTER TABLE llx_projet ADD COLUMN usage_organize_event integer DEFAULT 0;
UPDATE llx_projet set usage_opportunity = 1 WHERE fk_opp_status > 0;
ALTER TABLE llx_accounting_account MODIFY COLUMN rowid bigint AUTO_INCREMENT;
ALTER TABLE llx_supplier_proposaldet ADD COLUMN date_start datetime DEFAULT NULL;
ALTER TABLE llx_supplier_proposaldet ADD COLUMN date_end datetime DEFAULT NULL;
create table llx_c_hrm_public_holiday
(
id integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 0 NOT NULL, -- multi company id, 0 = all
fk_country integer,
code varchar(62),
dayrule varchar(64) DEFAULT '', -- 'easter', 'eastermonday', ...
day integer,
month integer,
year integer, -- 0 for all years
active integer DEFAULT 1,
import_key varchar(14)
)ENGINE=innodb;
ALTER TABLE llx_c_hrm_public_holiday ADD UNIQUE INDEX uk_c_hrm_public_holiday(entity, code);
ALTER TABLE llx_c_hrm_public_holiday ADD UNIQUE INDEX uk_c_hrm_public_holiday2(entity, fk_country, dayrule, day, month, year);
-- A lot of countries
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('NEWYEARDAY1', 0, 0, 0, 1, 1, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('LABORDAY1', 0, 0, 0, 5, 1, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('ASSOMPTIONDAY1', 0, 0, 0, 8, 15, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('CHRISTMASDAY1', 0, 0, 0, 12, 25, 1);
-- France only (1)
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('FR-VICTORYDAY', 0, 1, '', 0, 5, 8, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('FR-NATIONALDAY', 0, 1, '', 0, 7, 14, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('FR-ASSOMPTION', 0, 1, '', 0, 8, 15, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('FR-TOUSSAINT', 0, 1, '', 0, 11, 1, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('FR-ARMISTICE', 0, 1, '', 0, 11, 11, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('FR-EASTER', 0, 1, 'eastermonday', 0, 0, 0, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('FR-ASCENSION', 0, 1, 'ascension', 0, 0, 0, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('FR-PENTECOST', 0, 1, 'pentecost', 0, 0, 0, 1);
-- Italy (3)
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('IT-LIBEAZIONE', 0, 3, 0, 4, 25, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('IT-EPIPHANY', 0, 3, 0, 6, 1, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('IT-REPUBBLICA', 0, 3, 0, 6, 2, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('IT-TUTTISANTIT', 0, 3, 0, 11, 1, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('IT-IMMACULE', 0, 3, 0, 12, 8, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, year, month, day, active) VALUES('IT-SAINTSTEFAN', 0, 3, 0, 12, 26, 1);
-- Spain (4)
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('ES-EASTER', 0, 4, 'easter', 0, 0, 0, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('ES-REYE', 0, 4, '', 0, 6, 1, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('ES-HISPANIDAD', 0, 4, '', 0, 10, 12, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('ES-TOUSSAINT', 0, 4, '', 0, 11, 1, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('ES-CONSTITUIZION', 0, 4, '', 0, 12, 6, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('ES-IMMACULE', 0, 4, '', 0, 12, 8, 1);
-- Austria (41)
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-EASTER', 0, 41, 'eastermonday', 0, 0, 0, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-ASCENSION', 0, 41, 'ascension', 0, 0, 0, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-PENTECOST', 0, 41, 'pentecost', 0, 0, 0, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-FRONLEICHNAM', 0, 41, 'fronleichnam', 0, 0, 0, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-KONEGIE', 0, 41, '', 0, 6, 1, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-26OKT', 0, 41, '', 0, 10, 26, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-TOUSSAINT', 0, 41, '', 0, 11, 1, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-IMMACULE', 0, 41, '', 0, 12, 8, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-24DEC', 0, 41, '', 0, 12, 24, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-SAINTSTEFAN', 0, 41, '', 0, 12, 26, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('AT-Silvester', 0, 41, '', 0, 12, 31, 1);
-- India (117)
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('IN-REPUBLICDAY', 0, 117, '', 0, 1, 26, 1);
INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('IN-GANDI', 0, 117, '', 0, 10, 2, 1);

View File

@@ -284,7 +284,7 @@ CREATE TABLE llx_expensereport_det
total_ttc double(24,8) DEFAULT 0 NOT NULL,
date date NOT NULL,
info_bits integer DEFAULT 0, -- TVA NPR ou non
special_code integer DEFAULT 0, -- code pour les lignes speciales
special_code integer DEFAULT 0, -- code for special lines
rang integer DEFAULT 0, -- position of line
import_key varchar(14)
) ENGINE=innodb;

View File

@@ -285,7 +285,6 @@ DELETE from llx_accounting_account where rowid in (select minid from tmp_llx_acc
--update llx_facture_fourn_det set fk_code_ventilation = maxid WHERE fk_code_ventilation = minid;
--update llx_expensereport_det set fk_code_ventilation = maxid WHERE fk_code_ventilation = minid;
ALTER TABLE llx_accounting_account DROP INDEX uk_accounting_account;
ALTER TABLE llx_accounting_account ADD UNIQUE INDEX uk_accounting_account (account_number, entity, fk_pcg_version);

View File

@@ -60,6 +60,8 @@ CREATE TABLE llx_pos_cash_fence(
-- For 10.0
UPDATE llx_chargesociales SET date_creation = tms WHERE date_creation IS NULL;
DROP TABLE llx_cotisation;
ALTER TABLE llx_accounting_bookkeeping DROP COLUMN validated;
ALTER TABLE llx_accounting_bookkeeping_tmp DROP COLUMN validated;
@@ -94,6 +96,8 @@ ALTER TABLE llx_adherent ADD gender VARCHAR(10);
ALTER TABLE llx_adherent_type ADD morphy VARCHAR(3);
ALTER TABLE llx_subscription ADD fk_type integer;
UPDATE llx_subscription as s SET fk_type = (SELECT fk_adherent_type FROM llx_adherent as a where a.rowid = s.fk_adherent) where fk_type IS NULL;
-- Add url_id into unique index of bank_url
ALTER TABLE llx_bank_url DROP INDEX uk_bank_url;
ALTER TABLE llx_bank_url ADD UNIQUE INDEX uk_bank_url (fk_bank, url_id, type);
@@ -202,6 +206,9 @@ ALTER TABLE llx_user ADD COLUMN linkedin varchar(255) after whatsapp;
ALTER TABLE llx_expensereport_det ADD COLUMN fk_ecm_files integer DEFAULT NULL;
ALTER TABLE llx_expensereport ADD COLUMN paid smallint default 0 NOT NULL;
UPDATE llx_expensereport set paid = 1 WHERE fk_statut = 6 and paid = 0;
CREATE TABLE llx_bom_bom(
-- BEGIN MODULEBUILDER FIELDS
@@ -228,6 +235,7 @@ CREATE TABLE llx_bom_bom(
ALTER TABLE llx_bom_bom ADD COLUMN efficiency double(8,4) DEFAULT 1;
ALTER TABLE llx_bom_bom ADD COLUMN entity integer DEFAULT 1 NOT NULL;
ALTER TABLE llx_bom_bom ADD COLUMN date_valid datetime;
create table llx_bom_bom_extrafields
(
@@ -247,13 +255,13 @@ CREATE TABLE llx_bom_bomline(
import_key varchar(14),
qty double(24,8) NOT NULL,
efficiency double(8,4) NOT NULL DEFAULT 1,
rank integer NOT NULL
position integer NOT NULL
-- END MODULEBUILDER FIELDS
) ENGINE=innodb;
ALTER TABLE llx_bom_bomline ADD COLUMN efficiency double(8,4) DEFAULT 1;
ALTER TABLE llx_bom_bomline ADD COLUMN fk_bom_child integer NULL;
ALTER TABLE llx_bom_bomline ADD COLUMN position integer NOT NULL;
create table llx_bom_bomline_extrafields
(
@@ -390,3 +398,9 @@ insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) v
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (113, 'supplier_proposal', 'external', 'SERVICE', 'Contact fournisseur prestation', 1);
ALTER TABLE llx_ticket_extrafields ADD INDEX idx_ticket_extrafields (fk_object);
-- Use special_code=3 in Takepos
-- VMYSQL4.1 UPDATE llx_facturedet AS fd LEFT JOIN llx_facture AS f ON f.rowid = fd.fk_facture SET fd.special_code = 4 WHERE f.module_source = 'takepos' AND fd.special_code = 3;
UPDATE llx_website_page set fk_user_creat = fk_user_modif WHERE fk_user_creat IS NULL and fk_user_modif IS NOT NULL;

View File

@@ -199,6 +199,13 @@ delete from llx_element_element where sourcetype='commande' and fk_source not in
DELETE FROM llx_actioncomm_resources WHERE fk_actioncomm not in (select id from llx_actioncomm);
-- Fix link on parent that were removed
DROP table tmp_user;
CREATE TABLE tmp_user as (select * from llx_user);
UPDATE llx_user SET fk_user = NULL where fk_user NOT IN (select rowid from tmp_user);
UPDATE llx_product SET canvas = NULL where canvas = 'default@product';
UPDATE llx_product SET canvas = NULL where canvas = 'service@product';
@@ -400,6 +407,7 @@ ALTER TABLE llx_accounting_account ADD UNIQUE INDEX uk_accounting_account (accou
-- p.tva_tx = 0
-- where price = 17.5
UPDATE llx_chargesociales SET date_creation = tms WHERE date_creation IS NULL;
-- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES';
-- VMYSQL4.1 update llx_accounting_account set tms = datec where DATE(STR_TO_DATE(tms, '%Y-%m-%d')) IS NULL;

View File

@@ -21,7 +21,7 @@
create table llx_accounting_account
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
rowid bigint AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1 NOT NULL,
datec datetime,
tms timestamp,

View File

@@ -21,8 +21,9 @@ CREATE TABLE llx_accounting_bookkeeping
(
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1 NOT NULL, -- | multi company id
doc_date date NOT NULL, -- FEC:PieceDate
doc_type varchar(30) NOT NULL, -- | facture_client/reglement_client/facture_fournisseur/reglement_fournisseur
piece_num integer NOT NULL, -- FEC:EcritureNum | accounting transaction id
doc_date date NOT NULL, -- FEC:PieceDate | date of source document
doc_type varchar(30) NOT NULL, -- | facture_client/reglement_client/facture_fournisseur/reglement_fournisseur/import
doc_ref varchar(300) NOT NULL, -- FEC:PieceRef | facture_client/reglement_client/... reference number
fk_doc integer NOT NULL, -- | facture_client/reglement_client/... rowid
fk_docdet integer NOT NULL, -- | facture_client/reglement_client/... line rowid
@@ -48,7 +49,6 @@ CREATE TABLE llx_accounting_bookkeeping
fk_user integer NULL, -- The id of user that validate the accounting source document
code_journal varchar(32) NOT NULL, -- FEC:JournalCode
journal_label varchar(255), -- FEC:JournalLib
piece_num integer NOT NULL, -- FEC:EcritureNum | accounting source document
date_validated datetime, -- FEC:ValidDate | if empty: movement not validated / if not empty: movement validated (No deleting / No modification)
date_export datetime DEFAULT NULL, --
import_key varchar(14),

View File

@@ -26,13 +26,13 @@ CREATE TABLE llx_bom_bom(
fk_product integer,
qty double(24,8),
efficiency double(8,4) DEFAULT 1,
date_creation datetime NOT NULL,
date_creation datetime NOT NULL,
date_valid datetime,
tms timestamp,
date_valid datetime,
fk_user_creat integer NOT NULL,
fk_user_creat integer NOT NULL,
fk_user_modif integer,
fk_user_valid integer,
import_key varchar(14),
status integer NOT NULL
-- END MODULEBUILDER FIELDS
) ENGINE=innodb;
) ENGINE=innodb;

View File

@@ -23,6 +23,6 @@ CREATE TABLE llx_bom_bomline(
import_key varchar(14),
qty double(24,8) NOT NULL,
efficiency double(8,4) NOT NULL DEFAULT 1,
rank integer NOT NULL
position integer NOT NULL
-- END MODULEBUILDER FIELDS
) ENGINE=innodb;

View File

@@ -36,5 +36,4 @@ create table llx_c_field_list
visible tinyint DEFAULT 1 NOT NULL, -- visibility of field. 0=Never visible, 1=Visible on list and forms, 2=Visible on list only
enabled varchar(255) DEFAULT 1, -- Condition to show or hide
rang integer DEFAULT 0
)ENGINE=innodb;

View File

@@ -0,0 +1,21 @@
-- ========================================================================
-- 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 <http://www.gnu.org/licenses/>.
--
-- ========================================================================
ALTER TABLE llx_c_hrm_public_holiday ADD UNIQUE INDEX uk_c_hrm_public_holiday(entity, code);
ALTER TABLE llx_c_hrm_public_holiday ADD UNIQUE INDEX uk_c_hrm_public_holiday2(entity, fk_country, dayrule, day, month, year);

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 <http://www.gnu.org/licenses/>.
--
-- ========================================================================
create table llx_c_hrm_public_holiday
(
id integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 0 NOT NULL, -- multi company id, 0 = all
fk_country integer,
code varchar(62),
dayrule varchar(64) DEFAULT '', -- 'easter', 'eastermonday', ...
day integer,
month integer,
year integer, -- 0 for all years
active integer DEFAULT 1,
import_key varchar(14)
)ENGINE=innodb;

View File

@@ -20,5 +20,5 @@ create table llx_c_price_expression
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
title varchar(20) NOT NULL,
expression varchar(80) NOT NULL
expression varchar(255) NOT NULL
)ENGINE=innodb;

View File

@@ -16,5 +16,5 @@
--
-- ===================================================================
ALTER TABLE llx_c_shipment_mode ADD UNIQUE INDEX uk_c_shipment_mode (code);
ALTER TABLE llx_c_shipment_mode ADD UNIQUE INDEX uk_c_shipment_mode (code, entity);

View File

@@ -19,6 +19,7 @@
create table llx_c_shipment_mode
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1 NOT NULL, -- multi company id
tms timestamp,
code varchar(30) NOT NULL,
libelle varchar(50) NOT NULL,

View File

@@ -47,7 +47,7 @@ create table llx_commande_fournisseurdet
date_start datetime DEFAULT NULL, -- date debut si service
date_end datetime DEFAULT NULL, -- date fin si service
info_bits integer DEFAULT 0, -- TVA NPR ou non
special_code integer DEFAULT 0, -- code pour les lignes speciales
special_code integer DEFAULT 0, -- code for special lines
rang integer DEFAULT 0,
import_key varchar(14),
fk_unit integer DEFAULT NULL,

View File

@@ -0,0 +1,20 @@
-- ===================================================================
-- Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.
--
-- ===================================================================
ALTER TABLE llx_entrepot_extrafields ADD INDEX idx_entrepot_extrafields (fk_object);

View File

@@ -0,0 +1,26 @@
-- ========================================================================
-- Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.
--
-- ========================================================================
create table llx_entrepot_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
fk_object integer NOT NULL,
import_key varchar(14) -- import key
) ENGINE=innodb;

View File

@@ -27,6 +27,7 @@ create table llx_events
tms timestamp, -- date creation/modification
type varchar(32) NOT NULL, -- action type
entity integer DEFAULT 1 NOT NULL, -- multi company id
prefix_session varchar(255) NULL, -- prefix of session, obtained with dol_getprefix
dateevent datetime, -- date event
fk_user integer, -- id user
description varchar(250) NOT NULL, -- full description of action

View File

@@ -44,7 +44,7 @@ CREATE TABLE llx_expensereport (
fk_user_cancel integer DEFAULT NULL,
fk_statut integer NOT NULL, -- 1=brouillon, 2=validated (waiting approval), 4=canceled, 5=approved, 6=payed, 99=refused
fk_c_paiement integer DEFAULT NULL, -- deprecated
paid smallint default 0 NOT NULL, -- deprecated
paid smallint default 0 NOT NULL, -- deprecated (status is used instead)
note_public text,
note_private text,
detail_refuse varchar(255) DEFAULT NULL,

View File

@@ -43,7 +43,7 @@ CREATE TABLE llx_expensereport_det
total_ttc double(24,8) DEFAULT 0 NOT NULL,
date date NOT NULL,
info_bits integer DEFAULT 0, -- TVA NPR ou non
special_code integer DEFAULT 0, -- code pour les lignes speciales
special_code integer DEFAULT 0, -- code for special lines
fk_multicurrency integer,
multicurrency_code varchar(255),
multicurrency_subprice double(24,8) DEFAULT 0,

View File

@@ -88,6 +88,10 @@ create table llx_facture
situation_counter smallint, -- situation counter
situation_final smallint, -- is the situation final ?
retained_warranty real DEFAULT NULL, -- % of retained warranty
retained_warranty_date_limit date DEFAULT NULL,
retained_warranty_fk_cond_reglement integer DEFAULT NULL, -- payment condition of retained warranty
import_key varchar(14),
extraparams varchar(255), -- for other parameters with json format

View File

@@ -47,7 +47,7 @@ create table llx_facture_fourn_det
date_end datetime DEFAULT NULL, -- date fin si service
info_bits integer DEFAULT 0, -- TVA NPR ou non
fk_code_ventilation integer DEFAULT 0 NOT NULL,
special_code integer DEFAULT 0, -- code pour les lignes speciales
special_code integer DEFAULT 0, -- code for special lines
rang integer DEFAULT 0,
import_key varchar(14),
fk_unit integer DEFAULT NULL,

View File

@@ -52,7 +52,7 @@ create table llx_facturedet_rec
buy_price_ht double(24,8) DEFAULT 0, -- buying price. Note: this value is saved as an always positive value, even on credit notes (it is price we bought the product before selling it).
fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created)
special_code integer UNSIGNED DEFAULT 0, -- code pour les lignes speciales
special_code integer UNSIGNED DEFAULT 0, -- code for special lines
rang integer DEFAULT 0, -- ordre d'affichage
fk_contract_line integer NULL, -- id of contract line when template invoice comes from contract lines
fk_unit integer DEFAULT NULL,

View File

@@ -43,6 +43,7 @@ create table llx_mailing
date_valid datetime, --
date_appro datetime, --
date_envoi datetime, -- date d'envoi
tms timestamp,
fk_user_creat integer, -- user creator
fk_user_valid integer, -- user validator
fk_user_appro integer, -- not used

View File

@@ -34,5 +34,6 @@ create table llx_mailing_cibles
source_id integer,
source_type varchar(16),
date_envoi datetime,
tms timestamp,
error_text varchar(255) -- text with error if statut is -1
)ENGINE=innodb;

View File

@@ -20,6 +20,7 @@ CREATE TABLE llx_oauth_token (
service varchar(36),
token text, -- token in serialize() format, of an object StdOAuth2Token of library phpoauth2
tokenstring text, -- token in json format '{"access_token": "sk_test_cccc", "refresh_token": "rt_aaa", "token_type": "bearer", ..., "scope": "read_write"}
fk_soc integer,
fk_user integer,
fk_adherent integer,
entity integer DEFAULT 1

View File

@@ -28,7 +28,7 @@ create table llx_paiement
datep datetime, -- payment date
amount double(24,8) DEFAULT 0, -- amount paid in Dolibarr currency
multicurrency_amount double(24,8) DEFAULT 0, -- amount paid in invoice currency
fk_paiement integer NOT NULL,
fk_paiement integer NOT NULL, -- type of payment in llx_c_paiement
num_paiement varchar(50),
note text,
ext_payment_id varchar(128), -- external id of payment (for example Stripe charge id)

View File

@@ -0,0 +1,20 @@
-- ===================================================================
-- Copyright (C) 2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
--
-- 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 <http://www.gnu.org/licenses/>.
--
-- ===================================================================
ALTER TABLE llx_payment_salary_extrafields ADD INDEX idx_payment_salary_extrafields (fk_object);

View File

@@ -0,0 +1,25 @@
-- ===================================================================
-- Copyright (C) 2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
--
-- 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 <http://www.gnu.org/licenses/>.
--
-- ===================================================================
create table llx_payment_salary_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
fk_object integer NOT NULL, -- salary payment id
import_key varchar(14) -- import key
)ENGINE=innodb;

View File

@@ -42,7 +42,10 @@ create table llx_projet
--budget_days real, -- budget in days is sum of field planned_workload of tasks
opp_amount double(24,8),
budget_amount double(24,8),
bill_time integer DEFAULT 0, -- Set to 1 if time spent must be converted into invoices
usage_opportunity integer DEFAULT 0, -- Set to 1 if project is used to follow an opportunity
usage_task integer DEFAULT 1, -- Set to 1 if project is used to manage tasks and/or record timesheet
usage_bill_time integer DEFAULT 0, -- Set to 1 if time spent must be converted into invoices
usage_organize_event integer DEFAULT 0, -- Set to 1 if you want to use project to organize an event, receive attendees subscription
model_pdf varchar(255),
import_key varchar(14) -- Import key
)ENGINE=innodb;

View File

@@ -65,34 +65,34 @@ create table llx_societe
fk_typent integer DEFAULT 0, --
fk_forme_juridique integer DEFAULT 0, -- juridical status
fk_currency varchar(3), -- default currency
siren varchar(128), -- IDProf1: siren or RCS for france, ...
siret varchar(128), -- IDProf2: siret for france, ...
ape varchar(128), -- IDProf3: code ape for france, ...
idprof4 varchar(128), -- IDProf4: nu for france
idprof5 varchar(128), -- IDProf5: nu for france
idprof6 varchar(128), -- IDProf6: nu for france
tva_intra varchar(20), -- tva
capital double(24,8) DEFAULT NULL, -- capital de la societe
fk_stcomm integer DEFAULT 0 NOT NULL, -- commercial statut
siren varchar(128), -- IDProf1: depends on country (example: siren or RCS for france, ...)
siret varchar(128), -- IDProf2: depends on country (example: siret for france, ...)
ape varchar(128), -- IDProf3: depends on country (example: code ape for france, ...)
idprof4 varchar(128), -- IDProf4: depends on country (example: nu for france, ...)
idprof5 varchar(128), -- IDProf5: depends on country (example: nu for france, ...)
idprof6 varchar(128), -- IDProf6: depends on country (example: nu for france, ...
tva_intra varchar(20), -- vat numero
capital double(24,8) DEFAULT NULL, -- capital of company
fk_stcomm integer DEFAULT 0 NOT NULL, -- commercial status
note_private text, --
note_public text, --
model_pdf varchar(255),
prefix_comm varchar(5), -- prefix commercial
prefix_comm varchar(5), -- prefix commercial (deprecated)
client tinyint DEFAULT 0, -- client 0/1/2
fournisseur tinyint DEFAULT 0, -- fournisseur 0/1
supplier_account varchar(32), -- compte client chez un fournisseur
supplier_account varchar(32), -- Id of our customer account known by the supplier
fk_prospectlevel varchar(12), -- prospect level (in llx_c_prospectlevel)
fk_incoterms integer, -- for incoterms
location_incoterms varchar(255), -- for incoterms
customer_bad tinyint DEFAULT 0, -- mauvais payeur 0/1
customer_rate real DEFAULT 0, -- taux fiabilite client (0 a 1)
supplier_rate real DEFAULT 0, -- taux fiabilite fournisseur (0 a 1)
remise_client real DEFAULT 0, -- remise systematique pour le client
remise_supplier real DEFAULT 0, -- remise systematique auprès du fournisseur
mode_reglement tinyint, -- mode de reglement
cond_reglement tinyint, -- condition de reglement
mode_reglement_supplier tinyint, -- mode de reglement fournisseur
cond_reglement_supplier tinyint, -- condition de reglement fournisseur
remise_client real DEFAULT 0, -- discount by default granted to this customer
remise_supplier real DEFAULT 0, -- discount by default granted by this supplier
mode_reglement tinyint, -- payment mode customer
cond_reglement tinyint, -- payment term customer
mode_reglement_supplier tinyint, -- payment mode supplier
cond_reglement_supplier tinyint, -- payment term supplier
fk_shipping_method integer, -- preferred shipping method id
tva_assuj tinyint DEFAULT 1, -- assujeti ou non a la TVA
localtax1_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 1

View File

@@ -36,5 +36,6 @@ create table llx_stock_mouvement
fk_project integer,
fk_origin integer,
origintype varchar(32),
model_pdf varchar(255)
model_pdf varchar(255),
fk_projet integer NOT NULL DEFAULT 0
)ENGINE=innodb;

View File

@@ -40,6 +40,8 @@ CREATE TABLE llx_supplier_proposaldet (
total_localtax2 double(24,8) DEFAULT 0,
total_ttc double(24,8) DEFAULT 0,
product_type integer DEFAULT 0,
date_start datetime DEFAULT NULL, -- date debut si service
date_end datetime DEFAULT NULL, -- date fin si service
info_bits integer DEFAULT 0,
buy_price_ht double(24,8) DEFAULT 0,
fk_product_fournisseur_price integer DEFAULT NULL,

View File

@@ -36,7 +36,7 @@ create table llx_user
pass_encoding varchar(24),
pass varchar(128),
pass_crypted varchar(128),
pass_temp varchar(128), -- temporary password when asked for forget password or 'hashtoallowreset:YYYMMDDHHMMSS' (where date is max date of validaity)
pass_temp varchar(128), -- temporary password when asked for forget password or 'hashtoallowreset:YYYMMDDHHMMSS' (where date is max date of validity)
api_key varchar(128), -- key to use REST API by this user
gender varchar(10),
civility varchar(6),
@@ -82,6 +82,8 @@ create table llx_user
model_pdf varchar(255) DEFAULT NULL,
datelastlogin datetime,
datepreviouslogin datetime,
iplastlogin varchar(250),
ippreviouslogin varchar(250),
egroupware_id integer,
ldap_sid varchar(255) DEFAULT NULL,
openid varchar(255),

View File

@@ -106,6 +106,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_emailcollector_email
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_emailcollector_emailcollectoraction FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_emailcollector_emailcollectorfilter FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_entrepot FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_entrepot_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_events FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_expedition FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_expensereport FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
@@ -123,6 +124,8 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_fichinterdet_extrafi
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_livraison FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_loan FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_localtax FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_mailing FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_mailing_cibles FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_menu FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_notify FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_notify_def FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();

View File

@@ -78,6 +78,7 @@ print 'Option rebuild_product_thumbs (\'test\' or \'confirmed\') is '.(GETPOST('
print 'Option force_disable_of_modules_not_found (\'test\' or \'confirmed\') is '.(GETPOST('force_disable_of_modules_not_found', 'alpha')?GETPOST('force_disable_of_modules_not_found', 'alpha'):'undefined').'<br>'."\n";
print 'Option clean_perm_table (\'test\' or \'confirmed\') is '.(GETPOST('clean_perm_table', 'alpha')?GETPOST('clean_perm_table', 'alpha'):'undefined').'<br>'."\n";
print 'Option force_utf8_on_tables, for mysql/mariadb only (\'test\' or \'confirmed\') is '.(GETPOST('force_utf8_on_tables', 'alpha')?GETPOST('force_utf8_on_tables', 'alpha'):'undefined').'<br>'."\n";
print 'Option repair_link_dispatch_lines_supplier_order_lines, (\'test\' or \'confirmed\') is '.(GETPOST('repair_link_dispatch_lines_supplier_order_lines', 'alpha')?GETPOST('repair_link_dispatch_lines_supplier_order_lines', 'alpha'):'undefined').'<br>'."\n";
print '<br>';
print '<table cellspacing="0" cellpadding="1" border="0" width="100%">';
@@ -389,11 +390,82 @@ if ($ok && GETPOST('standard', 'alpha'))
{
$db->query($sqldelete);
print '<tr><td>Constant '.$obj->name.' set in entity '.$obj->entity.' with value '.$obj->value.' -> Module not enabled in entity '.$obj->entity.', we delete record</td></tr>';
print '<tr><td>Widget '.$obj->name.' set in entity '.$obj->entity.' with value '.$obj->value.' -> Module not enabled in entity '.$obj->entity.', we delete record</td></tr>';
}
else
{
print '<tr><td>Constant '.$obj->name.' set in entity '.$obj->entity.' with value '.$obj->value.' -> Module not enabled in entity '.$obj->entity.', we should delete record (not done, mode test)</td></tr>';
print '<tr><td>Widget '.$obj->name.' set in entity '.$obj->entity.' with value '.$obj->value.' -> Module not enabled in entity '.$obj->entity.', we should delete record (not done, mode test)</td></tr>';
}
}
else
{
//print '<tr><td>Constant '.$obj->name.' set in entity '.$obj->entity.' with value '.$obj->value.' -> Module found in entity '.$obj->entity.', we keep record</td></tr>';
}
}
}
$i++;
}
$db->commit();
}
}
}
// clean box of not enabled modules
if ($ok && GETPOST('standard', 'alpha'))
{
print '<tr><td colspan="2"><br>*** Clean definition of boxes of modules not enabled</td></tr>';
$sql ="SELECT file, entity FROM ".MAIN_DB_PREFIX."boxes_def";
$sql.=" WHERE file like '%@%'";
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
if ($num)
{
$db->begin();
$i = 0;
while ($i < $num)
{
$obj=$db->fetch_object($resql);
$reg = array();
if (preg_match('/^(.+)@(.+)$/i', $obj->file, $reg))
{
$name=$reg[1];
$module=$reg[2];
$sql2 ="SELECT COUNT(*) as nb";
$sql2.=" FROM ".MAIN_DB_PREFIX."const as c";
$sql2.=" WHERE name = 'MAIN_MODULE_".strtoupper($module)."'";
$sql2.=" AND entity = ".$obj->entity;
$sql2.=" AND value <> 0";
$resql2 = $db->query($sql2);
if ($resql2)
{
$obj2 = $db->fetch_object($resql2);
if ($obj2 && $obj2->nb == 0)
{
// Module not found, so we canremove entry
$sqldeletea = "DELETE FROM ".MAIN_DB_PREFIX."boxes WHERE entity = ".$obj->entity." AND box_id IN (SELECT rowid FROM ".MAIN_DB_PREFIX."boxes_def WHERE file = '".$obj->file."' AND entity = ".$obj->entity.")";
$sqldeleteb = "DELETE FROM ".MAIN_DB_PREFIX."boxes_def WHERE file = '".$obj->file."' AND entity = ".$obj->entity;
if (GETPOST('standard', 'alpha') == 'confirmed')
{
$db->query($sqldeletea);
$db->query($sqldeleteb);
print '<tr><td>Constant '.$obj->file.' set in boxes_def for entity '.$obj->entity.' but MAIN_MODULE_'.strtoupper($module).' not defined in entity '.$obj->entity.', we delete record</td></tr>';
}
else
{
print '<tr><td>Constant '.$obj->file.' set in boxes_def for entity '.$obj->entity.' but MAIN_MODULE_'.strtoupper($module).' not defined in entity '.$obj->entity.', we should delete record (not done, mode test)</td></tr>';
}
}
else
@@ -1204,6 +1276,144 @@ if ($ok && GETPOST('force_utf8_on_tables', 'alpha'))
}
}
//
if ($ok && GETPOST('repair_link_dispatch_lines_supplier_order_lines')) {
/*
* This script is meant to be run when upgrading from a dolibarr version < 3.8
* to a newer version.
*
* Version 3.8 introduces a new column in llx_commande_fournisseur_dispatch, which
* matches the dispatch to a specific supplier order line (so that if there are
* several with the same product, the user can specifically tell which products of
* which line were dispatched where).
*
* However when migrating, the new column has a default value of 0, which means that
* old supplier orders whose lines were dispatched using the old dolibarr version
* have unspecific dispatch lines, which are not taken into account by the new version,
* thus making the order look like it was never dispatched at all.
*
* This scripts sets this foreign key to the first matching supplier order line whose
* product (and supplier order of course) are the same as the dispatchs.
*
* If the dispatched quantity is more than indicated on the order line (this happens if
* there are several order lines for the same product), it creates new dispatch lines
* pointing to the other order lines accordingly, until all the dispatched quantity is
* accounted for.
*/
$repair_link_dispatch_lines_supplier_order_lines = GETPOST('repair_link_dispatch_lines_supplier_order_lines', 'alpha');
echo '<tr><th>Repair llx_commande_fournisseur_dispatch.fk_commandefourndet</th></tr>';
echo '<tr><td>Repair in progress. This may take a while.</td></tr>';
$sql_dispatch = 'SELECT * FROM ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch WHERE COALESCE(fk_commandefourndet, 0) = 0';
$db->begin();
$resql_dispatch = $db->query($sql_dispatch);
$n_processed_rows = 0;
$errors = array();
if ($resql_dispatch) {
if ($db->num_rows($resql_dispatch) == 0) {
echo '<tr><td>Nothing to do.</td></tr>';
exit;
}
while ($obj_dispatch = $db->fetch_object($resql_dispatch)) {
$sql_line = 'SELECT line.rowid, line.qty FROM ' . MAIN_DB_PREFIX . 'commande_fournisseurdet AS line'
. ' WHERE line.fk_commande = ' . $obj_dispatch->fk_commande
. ' AND line.fk_product = ' . $obj_dispatch->fk_product;
$resql_line = $db->query($sql_line);
// sil y a plusieurs lignes avec le même produit sur cette commande fournisseur,
// on divise la ligne de dispatch en autant de lignes quon en a sur la commande pour le produit
// et on met la quantité de la ligne dans la limite du "budget" indiqué par dispatch.qty
$remaining_qty = $obj_dispatch->qty;
$first_iteration = true;
if (!$resql_line) {
echo '<tr><td>Unable to find a matching supplier order line for dispatch #' . $obj_dispatch->rowid . '</td></tr>';
$errors[] = $sql_line;
$n_processed_rows++;
continue;
}
if ($db->num_rows($resql_line) == 0) continue;
while ($obj_line = $db->fetch_object($resql_line)) {
if (!$remaining_qty) break;
if (!$obj_line->rowid) {
continue;
}
$qty_for_line = min($remaining_qty, $obj_line->qty);
if ($first_iteration) {
$sql_attach = 'UPDATE ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch'
. ' SET fk_commandefourndet = ' . $obj_line->rowid . ', qty = ' . $qty_for_line
. ' WHERE rowid = ' . $obj_dispatch->rowid;
$first_iteration = false;
} else {
$sql_attach_values = array(
$obj_dispatch->fk_commande,
$obj_dispatch->fk_product,
$obj_line->rowid,
$qty_for_line,
$obj_dispatch->fk_entrepot,
$obj_dispatch->fk_user,
$obj_dispatch->datec ? '"' . $db->escape($obj_dispatch->datec) . '"' : 'NULL',
$obj_dispatch->comment ? '"' . $db->escape($obj_dispatch->comment) . '"' : 'NULL',
$obj_dispatch->status ?: 'NULL',
$obj_dispatch->tms ? '"' . $db->escape($obj_dispatch->tms) . '"': 'NULL',
$obj_dispatch->batch ?: 'NULL',
$obj_dispatch->eatby ? '"' . $db->escape($obj_dispatch->eatby) . '"': 'NULL',
$obj_dispatch->sellby ? '"' . $db->escape($obj_dispatch->sellby) . '"': 'NULL'
);
$sql_attach_values = join(', ', $sql_attach_values);
$sql_attach = 'INSERT INTO ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch'
. ' (fk_commande, fk_product, fk_commandefourndet, qty, fk_entrepot, fk_user, datec, comment, status, tms, batch, eatby, sellby)'
. ' VALUES (' . $sql_attach_values . ')';
}
if ($repair_link_dispatch_lines_supplier_order_lines == 'confirmed')
{
$resql_attach = $db->query($sql_attach);
}
else
{
$resql_attach = true; // Force success in test mode
}
if ($resql_attach) {
$remaining_qty -= $qty_for_line;
} else {
$errors[] = $sql_attach;
}
$first_iteration = false;
}
$n_processed_rows++;
// report progress every 256th row
if (!($n_processed_rows & 0xff)) {
echo '<tr><td>Processed ' . $n_processed_rows . ' rows with ' . count($errors) . ' errors…' . "</td></tr>\n";
flush();
ob_flush();
}
}
} else {
echo '<tr><td>Unable to find any dispatch without an fk_commandefourndet.' . "</td></tr>\n";
echo $sql_dispatch . "\n";
}
echo '<tr><td>Fixed ' . $n_processed_rows . ' rows with ' . count($errors) . ' errors…' . "</td></tr>\n";
echo '<tr><td>DONE.' . "</td></tr>\n";
if (count($errors)) {
$db->rollback();
echo '<tr><td>The transaction was rolled back due to errors: nothing was changed by the script.</td></tr>';
} else {
$db->commit();
}
$db->close();
echo '<tr><td><h3>SQL queries with errors:</h3></tr></td>';
echo '<tr><td>' . join('</td></tr><tr><td>', $errors) . '</td></tr>';
}
print '</table>';

View File

@@ -311,7 +311,7 @@ if ($action == "set")
{
$buf = fgets($fp, 4096);
// Cas special de lignes autorisees pour certaines versions uniquement
// Special case of lines allowed for some version only
if ($choix == 1 && preg_match('/^--\sV([0-9\.]+)/i', $buf, $reg))
{
$versioncommande=explode('.', $reg[1]);
@@ -450,6 +450,11 @@ if ($action == "set")
$buffer=trim($buffer);
if ($buffer)
{
// Replace the prefix in table names
if ($dolibarr_main_db_prefix != 'llx_')
{
$buffer=preg_replace('/llx_/i', $dolibarr_main_db_prefix, $buffer);
}
dolibarr_install_syslog("step2: request: " . $buffer);
print "<!-- Insert line : ".$buffer."<br>-->\n";
$resql=$db->query($buffer, 0, 'dml');
@@ -627,6 +632,25 @@ dolibarr_install_syslog("Exit ".$ret);
dolibarr_install_syslog("- step2: end");
$out = '<input type="checkbox" name="dolibarrpingno" id="dolibarrpingno" value="checked" checked="true"> ';
$out .= $langs->trans("MakeAnonymousPing");
$out .= '<!-- Add js script to manage the uncheck of option to not send the ping -->';
$out .= '<script type="text/javascript">';
$out .= 'jQuery(document).ready(function(){';
$out .= ' document.cookie = "DOLINSTALLNOPING_'.md5($dolibarr_main_instance_unique_id).'=0; path=/"'."\n";
$out .= ' jQuery("#dolibarrpingno").click(function() {';
$out .= ' if (! $(this).is(\':checked\')) {';
$out .= ' console.log("We uncheck anonymous ping");';
$out .= ' document.cookie = "DOLINSTALLNOPING_'.md5($dolibarr_main_instance_unique_id).'=1; path=/"'."\n";
$out .= ' }';
$out .= ' });';
$out .= '});';
$out .= '</script>';
print $out;
pFooter($ok?0:1, $setuplang);
if (isset($db) && is_object($db)) $db->close();

View File

@@ -80,11 +80,11 @@ $db=getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->
if ($db->ok)
{
print '<tr><td><label for="login">'.$langs->trans("Login").' :</label></td><td>';
print '<input id="login" name="login" type="text" value="' . (!empty($_GET["login"]) ? GETPOST("login") : (isset($force_install_dolibarrlogin) ? $force_install_dolibarrlogin : '')) . '"' . (@$force_install_noedit == 2 && $force_install_dolibarrlogin !== null ? ' disabled' : '') . '></td></tr>';
print '<input id="login" name="login" type="text" value="' . (!empty($_GET["login"]) ? GETPOST("login", 'alpha') : (isset($force_install_dolibarrlogin) ? $force_install_dolibarrlogin : '')) . '"' . (@$force_install_noedit == 2 && $force_install_dolibarrlogin !== null ? ' disabled' : '') . '></td></tr>';
print '<tr><td><label for="pass">'.$langs->trans("Password").' :</label></td><td>';
print '<input type="password" id="pass" name="pass"></td></tr>';
print '<input type="password" id="pass" name="pass" autocomplete="new-password"></td></tr>';
print '<tr><td><label for="pass_verif">'.$langs->trans("PasswordAgain").' :</label></td><td>';
print '<input type="password" id="pass_verif" name="pass_verif"></td></tr>';
print '<input type="password" id="pass_verif" name="pass_verif" autocomplete="new-password"></td></tr>';
print '</table>';
if (isset($_GET["error"]) && $_GET["error"] == 1)

View File

@@ -1089,7 +1089,7 @@ function migrate_links_transfert($db, $langs, $conf)
$sql.= "fk_bank, url_id, url, label, type";
$sql.= ")";
$sql.= " VALUES (";
$sql.= $obj->barowid.",".$obj->bbrowid.", '/compta/bank/ligne.php?rowid=', '(banktransfert)', 'banktransfert'";
$sql.= $obj->barowid.",".$obj->bbrowid.", '/compta/bank/line.php?rowid=', '(banktransfert)', 'banktransfert'";
$sql.= ")";
print $sql.'<br>';
@@ -1432,7 +1432,7 @@ function migrate_paiementfourn_facturefourn($db, $langs, $conf)
}
/**
* Mise a jour des totaux lignes de facture
* Update total of invoice lines
*
* @param DoliDB $db Database handler
* @param Translate $langs Object langs
@@ -1453,7 +1453,7 @@ function migrate_price_facture($db, $langs, $conf)
print '<br>';
print '<b>'.$langs->trans('MigrationInvoice')."</b><br>\n";
// Liste des lignes facture non a jour
// List of invoice lines not up to date
$sql = "SELECT fd.rowid, fd.qty, fd.subprice, fd.remise_percent, fd.tva_tx as vatrate, fd.total_ttc, fd.info_bits,";
$sql.= " f.rowid as facid, f.remise_percent as remise_percent_global, f.total_ttc as total_ttc_f";
$sql.= " FROM ".MAIN_DB_PREFIX."facturedet as fd, ".MAIN_DB_PREFIX."facture as f";
@@ -1551,7 +1551,7 @@ function migrate_price_facture($db, $langs, $conf)
}
/**
* Mise a jour des totaux lignes de propal
* Update total of proposal lines
*
* @param DoliDB $db Database handler
* @param Translate $langs Object langs
@@ -1570,7 +1570,7 @@ function migrate_price_propal($db, $langs, $conf)
print '<br>';
print '<b>'.$langs->trans('MigrationProposal')."</b><br>\n";
// Liste des lignes propal non a jour
// List of proposal lines not up to date
$sql = "SELECT pd.rowid, pd.qty, pd.subprice, pd.remise_percent, pd.tva_tx as vatrate, pd.info_bits,";
$sql.= " p.rowid as propalid, p.remise_percent as remise_percent_global";
$sql.= " FROM ".MAIN_DB_PREFIX."propaldet as pd, ".MAIN_DB_PREFIX."propal as p";
@@ -1679,7 +1679,7 @@ function migrate_price_contrat($db, $langs, $conf)
print '<br>';
print '<b>'.$langs->trans('MigrationContract')."</b><br>\n";
// Liste des lignes contrat non a jour
// List of contract lines not up to date
$sql = "SELECT cd.rowid, cd.qty, cd.subprice, cd.remise_percent, cd.tva_tx as vatrate, cd.info_bits,";
$sql.= " c.rowid as contratid";
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c";
@@ -1748,7 +1748,7 @@ function migrate_price_contrat($db, $langs, $conf)
}
/**
* Mise a jour des totaux lignes de commande
* Update total of sales order lines
*
* @param DoliDB $db Database handler
* @param Translate $langs Object langs
@@ -1767,7 +1767,7 @@ function migrate_price_commande($db, $langs, $conf)
print '<br>';
print '<b>'.$langs->trans('MigrationOrder')."</b><br>\n";
// Liste des lignes commande non a jour
// List of sales orders lines not up to date
$sql = "SELECT cd.rowid, cd.qty, cd.subprice, cd.remise_percent, cd.tva_tx as vatrate, cd.info_bits,";
$sql.= " c.rowid as commandeid, c.remise_percent as remise_percent_global";
$sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd, ".MAIN_DB_PREFIX."commande as c";
@@ -1865,7 +1865,7 @@ function migrate_price_commande($db, $langs, $conf)
}
/**
* Mise a jour des totaux lignes de commande fournisseur
* Update total of purchase order lines
*
* @param DoliDB $db Database handler
* @param Translate $langs Object langs
@@ -1884,7 +1884,7 @@ function migrate_price_commande_fournisseur($db, $langs, $conf)
print '<br>';
print '<b>'.$langs->trans('MigrationSupplierOrder')."</b><br>\n";
// Liste des lignes commande non a jour
// List of purchase order lines not up to date
$sql = "SELECT cd.rowid, cd.qty, cd.subprice, cd.remise_percent, cd.tva_tx as vatrate, cd.info_bits,";
$sql.= " c.rowid as commandeid, c.remise_percent as remise_percent_global";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd, ".MAIN_DB_PREFIX."commande_fournisseur as c";