Compare commits

...

55 Commits
4.0.1 ... 3.8

Author SHA1 Message Date
Laurent Destailleur
1ecc1afa9e Merge branch '3.7' of git@github.com:Dolibarr/dolibarr.git into 3.8 2020-01-10 19:41:49 +01:00
Laurent Destailleur
ceb1e699b7 Merge branch '3.6' of git@github.com:Dolibarr/dolibarr.git into 3.7 2020-01-10 19:37:16 +01:00
Laurent Destailleur
c028819cab FIX clone of purchase order 2020-01-10 19:35:49 +01:00
Laurent Destailleur
9d582a53ca Fix compatibility with new mysql versions 2018-11-23 11:28:28 +01:00
Laurent Destailleur
ca1e3b4d55 Merge branch '3.7' of git@github.com:Dolibarr/dolibarr.git into 3.8 2018-11-10 15:15:33 +01:00
Laurent Destailleur
94bb1ac511 Merge branch '3.6' of git@github.com:Dolibarr/dolibarr.git into 3.7 2018-11-10 12:49:22 +01:00
Laurent Destailleur
8893d8d59f Fix compatiblity with new version of PHP 2018-11-10 11:56:23 +01:00
Laurent Destailleur
e61bcd03ed Fix travis 2017-09-16 13:03:27 +02:00
Laurent Destailleur
3295498e9e Remove code comment 2017-09-16 12:50:34 +02:00
Laurent Destailleur
71818da6a5 Merge branch '3.7' of git@github.com:Dolibarr/dolibarr.git into 3.8 2017-08-22 11:13:58 +02:00
Laurent Destailleur
c53aef9955 Merge branch '3.7' of git@github.com:Dolibarr/dolibarr.git into 3.7 2017-08-22 10:51:30 +02:00
Laurent Destailleur
a18995d3dc Merge branch '3.6' of git@github.com:Dolibarr/dolibarr.git into 3.7 2017-08-22 10:47:47 +02:00
Laurent Destailleur
3017e2b3a0 Merge pull request #7232 from ATM-Marc/FIX_future_accounting
FIX calculate correct remain to pay for planned bank transactions
2017-08-04 15:23:00 +02:00
Marc de Lima Lucio
adbb41799c FIX: calculate correct remain to pay for planned bank transactions 2017-08-01 11:08:58 +02:00
Laurent Destailleur
12d7b92556 Merge branch '3.7' of git@github.com:Dolibarr/dolibarr.git into 3.8 2017-06-19 19:52:49 +02:00
Laurent Destailleur
6fb0fc7b71 Merge branch '3.6' of git@github.com:Dolibarr/dolibarr.git into 3.7 2017-06-19 19:42:56 +02:00
Laurent Destailleur
f694939fc7 Fix migration with pgsql 2017-06-19 19:39:37 +02:00
Laurent Destailleur
d0d9de37f4 Merge branch '3.7' of git@github.com:Dolibarr/dolibarr.git into 3.8 2017-06-19 04:05:40 +02:00
Laurent Destailleur
1bfdc7438a Merge branch '3.6' of git@github.com:Dolibarr/dolibarr.git into 3.7 2017-06-19 04:03:26 +02:00
Regis Houssin
9352ecca1f Fix: PHP 7 - Fatal error: 'break' not in the 'loop' or 'switch' context 2017-06-19 04:01:34 +02:00
Laurent Destailleur
774c624687 Merge branch '3.7' of git@github.com:Dolibarr/dolibarr.git into 3.8 2017-06-19 02:58:44 +02:00
Laurent Destailleur
5439390461 Merge branch '3.6' of git@github.com:Dolibarr/dolibarr.git into 3.7 2017-06-19 02:57:12 +02:00
Laurent Destailleur
6fc4dacd42 Fix migration opensurvey 2017-06-19 02:55:33 +02:00
Laurent Destailleur
b970596310 Merge pull request #6481 from Hugome/fix-agenda-merge
FIX : Agenda getCalendarEvents hook
2017-03-31 18:26:45 +02:00
hugome
38ccf7ffdd Fix : Agenda getCalendarEvents hook
Return of getCalendarEvents on agenda page :
The array_merge change key of merged array.
2017-03-13 11:35:49 +01:00
Laurent Destailleur
290caba160 Merge pull request #6413 from atm-gauthier/3.8_FIX_delete_bank_class_when_delete_bank_categ
FIX : delete bank class lines when we delete bank_categ
2017-02-12 20:45:57 +01:00
gauthier
c01988ba43 FIX : delete bank class lines when we delete bank_categ 2017-02-09 17:28:37 +01:00
Laurent Destailleur
797b68fc20 Merge pull request #6351 from atm-maxime/fix_banklink_expensereport
Fix : link to user in bank was wrong regarding expensereport payment
2017-02-02 01:18:04 +01:00
Maxime Kohlhaas
90e8f062e9 Fix : link to user in bank was wrong regarding expensereport payment 2017-01-31 10:23:03 +01:00
Laurent Destailleur
f49552f6b7 Merge pull request #6297 from atm-arnaud/FIX_ajax_project_list_where
FIX all dolibarr versions about project list and ajax completion bug
2017-01-18 16:33:23 +01:00
arnaud
39f35bbaab FIX all dolibarr versions about project list and ajax completion bug 2017-01-17 11:17:40 +01:00
Laurent Destailleur
321933f267 Fix deletion of product 2016-12-18 02:10:26 +01:00
Laurent Destailleur
f49d332b73 Merge pull request #6113 from atm-maxime/3.8
Fix : delete product was not possible if batch stock
2016-12-10 13:16:50 +01:00
Laurent Destailleur
46d84f8f11 Merge pull request #6111 from simnandez/3.8
Fix: Delete surplus migration file
2016-12-10 13:16:16 +01:00
Maxime Kohlhaas
97e21cb775 Fix : delete product was not possible if batch stock 2016-12-10 13:05:46 +01:00
Juanjo Menent
829ff2299e Fix: Delete surplus migration file 2016-12-10 12:46:26 +01:00
Laurent Destailleur
f516660c0f Merge branch '3.7' of git@github.com:Dolibarr/dolibarr.git into 3.8 2016-11-06 14:10:37 +01:00
Laurent Destailleur
73f0159578 Fix phpunit 2016-11-06 14:08:55 +01:00
Juanjo Menent
7acc14903c Merge pull request #5937 from atm-maxime/fix_supporder_vars_set
Fix : vars were not set after commande function
2016-10-28 11:18:15 +02:00
Juanjo Menent
57a8e053b4 Merge pull request #5936 from atm-maxime/fix_pdfmuscadet_hook_call
Fix bad parameter in hook call
2016-10-28 11:17:21 +02:00
Maxime Kohlhaas
3dbab863a7 Fix : vars were not set after commande function 2016-10-28 10:24:31 +02:00
Maxime Kohlhaas
be493fcf09 Fix bad parameter in hook call 2016-10-28 10:16:58 +02:00
Laurent Destailleur
5e7c72068d Merge pull request #5923 from olsesacl/#5907
FIX: #5907 No translation string for PDF Proposal
2016-10-26 10:56:15 +02:00
Sergio Sanchis Climent
2a4517e1bc FIX: #5907 2016-10-24 19:21:41 +02:00
Laurent Destailleur
e4da87d31c Merge pull request #5903 from atm-gauthier/FIX_thirdparty_margin
FIX : margin tab on customer card must filter on current entity invoices
2016-10-24 03:18:37 +02:00
Laurent Destailleur
fe71c0cb2d Merge pull request #5886 from simnandez/3.8
Fix: Bad localtaxes calc for Spain if VAT is 0
2016-10-24 01:01:04 +02:00
gauthier
a814e02d53 FIX : margin tab on customer card must filter on current entity invoices 2016-10-21 12:40:19 +02:00
Juanjo Menent
6a944bb6a3 Fix: Bad localtaxes calc for Spain if VAT is 0 2016-10-18 10:11:42 +02:00
Juanjo Menent
87e8ac51be Merge pull request #5843 from simnandez/3.8
FIX: Error when CATEGORIE_RECURSIV_ADD is enabled and new category is daughter of an already linked to object
2016-10-15 17:18:35 +02:00
Juanjo Menent
ffd486e3d6 Fix #5843 best way fixing 2016-10-07 22:54:08 +02:00
Juanjo Menent
45dfb8ca62 Fix #5843 best way fixing 2016-10-07 22:32:11 +02:00
Juanjo Menent
298e5cee61 Fix #5843 best way fixing 2016-10-07 22:21:50 +02:00
Juanjo Menent
b7b18e3355 FIX: Error when CATEGORIE_RECURSIV_ADD is enabled and new category is daughter of an already linked to object 2016-10-07 10:12:25 +02:00
Laurent Destailleur
b19b624908 Merge pull request #5834 from simnandez/3.8
FIX: only show projects of related third if external user
2016-10-06 23:58:24 +02:00
Juanjo Menent
56245e2c9a FIX: only show projects of related third if external user 2016-10-04 16:51:44 +02:00
18 changed files with 97 additions and 59 deletions

View File

@@ -126,10 +126,10 @@ before_script:
echo "Set timezone" echo "Set timezone"
echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
if [ "$TRAVIS_PHP_VERSION" = '5.3' ] || [ "$TRAVIS_PHP_VERSION" = '5.4' ]; then if [ "$TRAVIS_PHP_VERSION" = '5.3' ] || [ "$TRAVIS_PHP_VERSION" = '5.4' ]; then
echo #echo
echo "Enabling APC for PHP <= 5.4" #echo "Enabling APC for PHP <= 5.4"
# Documentation says it should be available for PHP <= 5.6 but it's not for 5.5 and 5.6! # Documentation says it should be available for PHP <= 5.6 but it's not for 5.5 and 5.6!
echo 'extension = apc.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini #echo 'extension = apc.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
echo echo
echo "Enabling Memcached for PHP <= 5.4" echo "Enabling Memcached for PHP <= 5.4"
# Documentation says it should be available for all PHP versions but it's not for 5.5 and 5.6, 7.0 and nightly! # Documentation says it should be available for all PHP versions but it's not for 5.5 and 5.6, 7.0 and nightly!

View File

@@ -5,7 +5,7 @@
* Copyright (C) 2006-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2006-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2013-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
@@ -592,17 +592,19 @@ class Categorie extends CommonObject
{ {
if ($this->db->num_rows($resql) > 0) if ($this->db->num_rows($resql) > 0)
{ {
$objparent = $this->db->fetch_object($resql); $objparent = $this->db->fetch_object($resql);
if (!empty($objparent->fk_parent)) if (!empty($objparent->fk_parent))
{ {
$cat = new Categorie($this->db); $cat = new Categorie($this->db);
$cat->id=$objparent->fk_parent; $cat->id = $objparent->fk_parent;
$result=$cat->add_type($obj, $type); if (!$cat->containsObject($type, $obj->id)) {
if ($result < 0) $result = $cat->add_type($obj, $type);
{ if ($result < 0)
$this->error=$cat->error; {
$error++; $this->error = $cat->error;
$error++;
}
} }
} }
} }

View File

@@ -919,7 +919,14 @@ if (count($listofextcals))
// Complete $eventarray with events coming from external module // Complete $eventarray with events coming from external module
$parameters=array(); $object=null; $parameters=array(); $object=null;
$reshook=$hookmanager->executeHooks('getCalendarEvents',$parameters,$object,$action); $reshook=$hookmanager->executeHooks('getCalendarEvents',$parameters,$object,$action);
if (! empty($hookmanager->resArray['eventarray'])) $eventarray=array_merge($eventarray, $hookmanager->resArray['eventarray']); if (! empty($hookmanager->resArray['eventarray'])) {
foreach ($hookmanager->resArray['eventarray'] as $keyDate => $events) {
if (!isset($eventarray[$keyDate])) {
$eventarray[$keyDate]=array();
}
$eventarray[$keyDate]=array_merge($eventarray[$keyDate], $events);
}
}

View File

@@ -87,6 +87,17 @@ if ($action == 'delete')
{ {
if (GETPOST('categid')) if (GETPOST('categid'))
{ {
// Delete bank class
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class";
$sql.= " WHERE fk_categ = '".GETPOST('categid')."'";
$result = $db->query($sql);
if (!$result)
{
dol_print_error($db);
}
// Delete bank categ
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_categ"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_categ";
$sql.= " WHERE rowid = '".GETPOST('categid')."'"; $sql.= " WHERE rowid = '".GETPOST('categid')."'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;

View File

@@ -282,6 +282,8 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$refcomp=$societestatic->getNomUrl(1,'',24); $refcomp=$societestatic->getNomUrl(1,'',24);
$paiement = $facturestatic->getSommePaiement(); // Payment already done $paiement = $facturestatic->getSommePaiement(); // Payment already done
$paiement+= $facturestatic->getSumDepositsUsed();
$paiement+= $facturestatic->getSumCreditNotesUsed();
} }
if ($obj->family == 'social_contribution') if ($obj->family == 'social_contribution')
{ {

View File

@@ -2,6 +2,7 @@
/* Copyright (C) 2012-2014 Charles-François BENKE <charles.fr@benke.fr> /* Copyright (C) 2012-2014 Charles-François BENKE <charles.fr@benke.fr>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr> * Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2016 Juan José Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -79,8 +80,10 @@ class box_project extends ModeleBoxes
$sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut "; $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut ";
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
if($user->socid) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=p.fk_soc";
$sql.= " WHERE p.entity = ".$conf->entity; $sql.= " WHERE p.entity = ".$conf->entity;
$sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts if($user->socid) $sql.= " AND s.rowid = ".$user->socid;
$sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts
$sql.= " ORDER BY p.datec DESC"; $sql.= " ORDER BY p.datec DESC";
$sql.= $db->plimit($max, 0); $sql.= $db->plimit($max, 0);

View File

@@ -127,13 +127,15 @@ class FormProjets
// Search all projects // Search all projects
$sql = 'SELECT p.rowid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public'; $sql = 'SELECT p.rowid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public';
$sql.= ' FROM '.MAIN_DB_PREFIX .'projet as p'; $sql.= ' FROM '.MAIN_DB_PREFIX .'projet as p';
$sql.= " WHERE p.entity = ".$conf->entity; $sql.= " WHERE p.entity IN (".getEntity('project',1).")";
if ($projectsListId !== false) $sql.= " AND p.rowid IN (".$projectsListId.")"; if ($projectsListId !== false) $sql.= " AND p.rowid IN (".$projectsListId.")";
if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)"; if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)";
if (!empty($filterkey)) { if (!empty($filterkey)) {
$sql .= ' AND p.title LIKE "%'.$this->db->escape($filterkey).'%"'; $sql .= ' AND (';
$sql .= ' p.title LIKE "%'.$this->db->escape($filterkey).'%"';
$sql .= ' OR p.ref LIKE "%'.$this->db->escape($filterkey).'%"'; $sql .= ' OR p.ref LIKE "%'.$this->db->escape($filterkey).'%"';
$sql .= ')';
} }
$sql.= " ORDER BY p.ref ASC"; $sql.= " ORDER BY p.ref ASC";

View File

@@ -7,7 +7,7 @@
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr> * Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2014 Cédric GROSS <c.gross@kreiz-it.fr> * Copyright (C) 2014 Cédric GROSS <c.gross@kreiz-it.fr>
@@ -3170,7 +3170,7 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="")
{ {
if ($local == 1) if ($local == 1)
{ {
if(! $mysoc->localtax1_assuj) return 0; if(! $mysoc->localtax1_assuj || $tva=="0") return 0;
if ($thirdparty_seller->id==$mysoc->id) if ($thirdparty_seller->id==$mysoc->id)
{ {
if (! $thirdparty_buyer->localtax1_assuj) return 0; if (! $thirdparty_buyer->localtax1_assuj) return 0;
@@ -3183,7 +3183,7 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="")
if ($local == 2) if ($local == 2)
{ {
if(! $mysoc->localtax2_assuj) return 0; if(! $mysoc->localtax2_assuj || $tva=="0") return 0;
if ($thirdparty_seller->id==$mysoc->id ) if ($thirdparty_seller->id==$mysoc->id )
{ {
if (! $thirdparty_buyer->localtax2_assuj) return 0; if (! $thirdparty_buyer->localtax2_assuj) return 0;

View File

@@ -211,7 +211,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$hookmanager->initHooks(array('pdfgeneration')); $hookmanager->initHooks(array('pdfgeneration'));
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action; global $action;
$reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
$nblignes = count($object->lines); $nblignes = count($object->lines);

View File

@@ -527,13 +527,14 @@ class PaymentExpenseReport extends CommonObject
{ {
if ($mode == 'payment_expensereport') if ($mode == 'payment_expensereport')
{ {
$euser = new User($this->db); $er = new ExpenseReport($this->db);
$euser->fetch($key); $er->fetch($key);
$er->fetch_user($er->fk_user_author);
$result=$acc->add_url_line( $result=$acc->add_url_line(
$bank_line_id, $bank_line_id,
$euser->id, $er->user->id,
DOL_URL_ROOT.'/user/card.php?id=', DOL_URL_ROOT.'/user/card.php?id=',
$euser->getFullName($langs), $er->user->getFullName($langs),
'user' 'user'
); );
if ($result <= 0) if ($result <= 0)

View File

@@ -131,11 +131,11 @@ class Export
//print_r("$perm[0]-$perm[1]-$perm[2]<br>"); //print_r("$perm[0]-$perm[1]-$perm[2]<br>");
if (! empty($perm[2])) if (! empty($perm[2]))
{ {
$bool=$user->rights->$perm[0]->$perm[1]->$perm[2]; $bool=$user->rights->{$perm[0]}->{$perm[1]}->{$perm[2]};
} }
else else
{ {
$bool=$user->rights->$perm[0]->$perm[1]; $bool=$user->rights->{$perm[0]}->{$perm[1]};
} }
if ($perm[0]=='user' && $user->admin) $bool=true; if ($perm[0]=='user' && $user->admin) $bool=true;
if (! $bool) break; if (! $bool) break;

View File

@@ -950,6 +950,8 @@ class CommandeFournisseur extends CommonOrder
{ {
$result = 1; $result = 1;
$this->log($user, 3, $date, $comment); $this->log($user, 3, $date, $comment);
$this->date_commande = $date;
$this->methode_commande = $methode;
} }
else else
{ {
@@ -1049,6 +1051,7 @@ class CommandeFournisseur extends CommonOrder
$this->lines[$i]->remise_percent, $this->lines[$i]->remise_percent,
'HT', 'HT',
0, 0,
$this->lines[$i]->product_type,
$this->lines[$i]->info_bits $this->lines[$i]->info_bits
); );
if ($result < 0) if ($result < 0)

View File

@@ -62,6 +62,21 @@ ALTER TABLE llx_societe MODIFY COLUMN fk_currency varchar(3) NULL;
ALTER TABLE llx_bookmark ADD COLUMN entity integer DEFAULT 1 NOT NULL; ALTER TABLE llx_bookmark ADD COLUMN entity integer DEFAULT 1 NOT NULL;
ALTER TABLE llx_bookmark MODIFY COLUMN url varchar(255) NOT NULL; ALTER TABLE llx_bookmark MODIFY COLUMN url varchar(255) NOT NULL;
-- VMYSQL4.1 ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN tms timestamp DEFAULT '2001-01-01 00:00:00';
-- Clean corrupted values for tms
-- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES';
-- VMYSQL4.1 update llx_opensurvey_sondage set tms = date_fin where DATE(STR_TO_DATE(tms, '%Y-%m-%d')) IS NULL;
-- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE';
-- VMYSQL4.1 update llx_opensurvey_sondage set tms = date_fin where DATE(STR_TO_DATE(tms, '%Y-%m-%d')) IS NULL;
-- Remove default not null on date_fin
-- VMYSQL4.3 ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN date_fin DATETIME NULL DEFAULT NULL;
-- VPGSQL8.2 ALTER TABLE llx_opensurvey_sondage ALTER COLUMN date_fin DROP NOT NULL;
-- VMYSQL4.1 ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP;
ALTER TABLE llx_opensurvey_sondage ADD COLUMN entity integer DEFAULT 1 NOT NULL; ALTER TABLE llx_opensurvey_sondage ADD COLUMN entity integer DEFAULT 1 NOT NULL;
ALTER TABLE llx_opensurvey_sondage ADD COLUMN allow_comments tinyint NOT NULL DEFAULT 1; ALTER TABLE llx_opensurvey_sondage ADD COLUMN allow_comments tinyint NOT NULL DEFAULT 1;
-- ALTER TABLE llx_opensurvey_sondage DROP COLUMN survey_link_visible; -- ALTER TABLE llx_opensurvey_sondage DROP COLUMN survey_link_visible;
@@ -189,9 +204,14 @@ CREATE TABLE llx_payment_salary (
fk_user_modif integer fk_user_modif integer
)ENGINE=innodb; )ENGINE=innodb;
DELETE FROM llx_product_batch where fk_product_stock NOT IN (SELECT rowid from llx_product_stock);
ALTER TABLE llx_product_batch ADD INDEX idx_fk_product_stock (fk_product_stock); ALTER TABLE llx_product_batch ADD INDEX idx_fk_product_stock (fk_product_stock);
ALTER TABLE llx_product_batch ADD CONSTRAINT fk_product_batch_fk_product_stock FOREIGN KEY (fk_product_stock) REFERENCES llx_product_stock (rowid); ALTER TABLE llx_product_batch ADD CONSTRAINT fk_product_batch_fk_product_stock FOREIGN KEY (fk_product_stock) REFERENCES llx_product_stock (rowid);
DELETE FROM llx_expeditiondet_batch where fk_expeditiondet NOT IN (SELECT rowid from llx_expeditiondet);
ALTER TABLE llx_expeditiondet_batch ADD INDEX idx_fk_expeditiondet (fk_expeditiondet); ALTER TABLE llx_expeditiondet_batch ADD INDEX idx_fk_expeditiondet (fk_expeditiondet);
ALTER TABLE llx_expeditiondet_batch ADD CONSTRAINT fk_expeditiondet_batch_fk_expeditiondet FOREIGN KEY (fk_expeditiondet) REFERENCES llx_expeditiondet(rowid); ALTER TABLE llx_expeditiondet_batch ADD CONSTRAINT fk_expeditiondet_batch_fk_expeditiondet FOREIGN KEY (fk_expeditiondet) REFERENCES llx_expeditiondet(rowid);

View File

@@ -1,30 +0,0 @@
--
-- Be carefull to requests order.
-- This file must be loaded by calling /install/index.php page
-- when current version is 3.9.0 or higher.
--
-- 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 restrict request to Mysql version x.y use -- VMYSQLx.y
-- To restrict request to Pgsql version x.y use -- VPGSQLx.y
-- To make pk to be auto increment (mysql): VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
-- To make pk to be auto increment (postgres): VPGSQL8.2 NOT POSSIBLE. MUST DELETE/CREATE TABLE
-- To set a field as NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL;
-- To set a field as default NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL;
-- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user);
-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
-- Fix bad data
update llx_opensurvey_sondage set format = 'D' where format = 'D+';
update llx_opensurvey_sondage set format = 'A' where format = 'A+';
INSERT INTO llx_const (name, value, type, note, visible) values ('MAIN_DELAY_EXPENSEREPORTS_TO_PAY','31','chaine','Tolérance de retard avant alerte (en jours) sur les notes de frais impayées',0);
ALTER TABLE llx_accounting_system MODIFY COLUMN pcg_version varchar(32);
ALTER TABLE llx_accountingaccount MODIFY COLUMN fk_pcg_version varchar(32);

View File

@@ -31,7 +31,7 @@ create table llx_product
datec datetime, datec datetime,
tms timestamp, tms timestamp,
virtual tinyint DEFAULT 0 NOT NULL, -- Not used. Used by external modules. Value 0 for physical product, 1 for virtual product `virtual` tinyint DEFAULT 0 NOT NULL, -- Not used. Used by external modules. Value 0 for physical product, 1 for virtual product
fk_parent integer DEFAULT 0, -- Not used. Used by external modules. Virtual product id fk_parent integer DEFAULT 0, -- Not used. Used by external modules. Virtual product id
label varchar(255) NOT NULL, label varchar(255) NOT NULL,

View File

@@ -576,6 +576,7 @@ MailSentBy=Email sent by
TextUsedInTheMessageBody=Email body TextUsedInTheMessageBody=Email body
SendAcknowledgementByMail=Send Ack. by email SendAcknowledgementByMail=Send Ack. by email
NoEMail=No email NoEMail=No email
Email=Email
NoMobilePhone=No mobile phone NoMobilePhone=No mobile phone
Owner=Owner Owner=Owner
DetectedVersion=Detected version DetectedVersion=Detected version

View File

@@ -152,7 +152,7 @@ if ($socid > 0)
$sql.= ", ".MAIN_DB_PREFIX."facturedet as d"; $sql.= ", ".MAIN_DB_PREFIX."facturedet as d";
$sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " WHERE f.fk_soc = s.rowid";
$sql.= " AND f.fk_statut > 0"; $sql.= " AND f.fk_statut > 0";
$sql.= " AND s.entity = ".$conf->entity; $sql.= " AND f.entity = ".$conf->entity;
$sql.= " AND d.fk_facture = f.rowid"; $sql.= " AND d.fk_facture = f.rowid";
$sql.= " AND f.fk_soc = $socid"; $sql.= " AND f.fk_soc = $socid";
$sql.= " AND d.buy_price_ht IS NOT NULL"; $sql.= " AND d.buy_price_ht IS NOT NULL";

View File

@@ -876,10 +876,26 @@ class Product extends CommonObject
// End call triggers // End call triggers
} }
// Delete all child tables // Delete from product_batch on product delete
if (! $error) if (! $error)
{ {
$elements = array('product_fournisseur_price','product_price','product_lang','categorie_product','product_stock','product_customer_price'); $sql = "DELETE FROM ".MAIN_DB_PREFIX.'product_batch';
$sql.= " WHERE fk_product_stock IN (";
$sql.= "SELECT rowid FROM ".MAIN_DB_PREFIX.'product_stock';
$sql.= " WHERE fk_product = ".$id.")";
dol_syslog(get_class($this).'::delete', LOG_DEBUG);
$result = $this->db->query($sql);
if (! $result)
{
$error++;
$this->errors[] = $this->db->lasterror();
}
}
// Delete all child tables
if (! $error)
{
$elements = array('product_fournisseur_price','product_price','product_lang','categorie_product','product_stock','product_customer_price'); // product_batch done before
foreach($elements as $table) foreach($elements as $table)
{ {
if (! $error) if (! $error)