2
0
forked from Wavyzz/dolibarr

Compare commits

...

80 Commits
5.0.1 ... 3.9

Author SHA1 Message Date
Laurent Destailleur
7c0a6946a7 Merge branch '3.8' of git@github.com:Dolibarr/dolibarr.git into 3.9 2020-01-10 19:42:15 +01:00
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
d59b1bb0c6 Merge 2018-11-23 11:44:07 +01:00
Laurent Destailleur
9d582a53ca Fix compatibility with new mysql versions 2018-11-23 11:28:28 +01:00
Laurent Destailleur
3d85407619 Merge branch '3.8' of git@github.com:Dolibarr/dolibarr.git into 3.9 2018-11-10 15:46:31 +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
9253fed754 Revert "Code comment"
This reverts commit 8000777864.
2018-01-11 00:17:32 +01:00
Laurent Destailleur
8000777864 Code comment 2018-01-10 20:43:56 +01:00
Laurent Destailleur
141df52dd6 Merge pull request #7741 from frederic34/patch-1
swap llxfooter() and $db->close()
2017-11-02 09:53:06 +01:00
Frédéric FRANCE
01a3787664 swap llxfooter() and $db->close() 2017-10-31 13:45:13 +01:00
Laurent Destailleur
8ac7dd8e9a Merge pull request #7660 from atm-gauthier/fix_project_time_spent
FIX : wrong personnal project time spent
2017-10-22 02:26:34 +02:00
gauthier
3793ae323a FIX : wrong personnal project time spent 2017-10-19 09:46:19 +02: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
d5d337c631 Merge branch '3.8' of git@github.com:Dolibarr/dolibarr.git into 3.9 2017-08-22 11:14:27 +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
d345b9503a Merge branch '3.9' of git@github.com:Dolibarr/dolibarr.git into 3.9 2017-08-04 15:28:03 +02:00
Laurent Destailleur
f8d6eb0d40 Merge branch '3.8' of git@github.com:Dolibarr/dolibarr.git into 3.9 2017-08-04 15:25:41 +02:00
Laurent Destailleur
7d9b9f96f0 Merge pull request #7234 from fmarcet/3.9
Fix: Correction in the calculation of the next week
2017-08-04 15:25:05 +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
Ferran Marcet
09c271b7c5 Fix: Correction in the calculation of the next week 2017-08-02 10:31:16 +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
1fcc2c4918 Merge pull request #7172 from atm-gauthier/3.9_fix_positivebuyingprice
FIX : Buying prices must always be in positive valueo
2017-07-21 15:13:48 +02:00
Laurent Destailleur
e19167dffa Merge pull request #7154 from atm-ph/fix_3.9_contrat_updateline_extra
Fix updateline extrafields contrat fail
2017-07-18 14:30:55 +02:00
gauthier
ccbeb162cf FIX : Buying prices must always be in positive valueo 2017-07-17 11:27:57 +02:00
phf
f1c23f25f0 Fix updateline extrafields contrat fail 2017-07-13 16:49:58 +02:00
Laurent Destailleur
724392a557 Merge pull request #7073 from fmarcet/3.9
FIX: User id correction on holiday request
2017-06-29 02:45:53 +02:00
fmarcet
4283b1ee30 FIX: User id correction on holiday request 2017-06-28 18:31:37 +02:00
Laurent Destailleur
f899408fc9 Merge pull request #7063 from atm-arnaud/FIX_invoice_page_list
FIX invoice page list
2017-06-27 18:37:51 +02:00
arnaud
65b9b70ff8 FIX invoice page list 2017-06-27 15:23:51 +02:00
Laurent Destailleur
a8d7764146 Merge branch '3.9' of git@github.com:Dolibarr/dolibarr.git into 3.9 2017-06-27 12:06:16 +02:00
Laurent Destailleur
99c7867522 Fix travis 2017-06-27 12:06:01 +02:00
Laurent Destailleur
1f83bef1b5 Merge pull request #7035 from fmarcet/3.9
Fix: User id correction on holiday request
2017-06-20 00:57:10 +02:00
Laurent Destailleur
1745d06bb7 Merge branch '3.8' of git@github.com:Dolibarr/dolibarr.git into 3.9 2017-06-19 19:56:16 +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
fmarcet
c4546b6da6 FIX: User id correction on holiday request 2017-06-19 16:23:44 +02:00
Ferran Marcet
03eadcebf1 FIX: User id correction on holiday request 2017-06-19 12:25:00 +02:00
Laurent Destailleur
ebc18cd2d4 Merge branch '3.8' of git@github.com:Dolibarr/dolibarr.git into 3.9 2017-06-19 04:13:24 +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
39419bb411 Merge branch '3.8' of git@github.com:Dolibarr/dolibarr.git into 3.9 2017-06-19 02:59:16 +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
36a72de080 Merge pull request #6924 from atm-maxime/3.9
Fix : SEPA XML address should also have dolEscapeXML
2017-06-06 10:26:46 +02:00
Maxime Kohlhaas
6787d717f9 Update bonprelevement.class.php 2017-06-03 18:23:19 +02:00
Maxime Kohlhaas
0e175ba373 Fix : SEPA XML address should also have dolEscapeXML 2017-06-01 11:48:14 +02:00
Laurent Destailleur
d55cc58b8b Merge pull request #6914 from atm-maxime/3.9
Fix special char and size limit in SEPA XML
2017-05-31 19:08:05 +02:00
Laurent Destailleur
d70c14a411 Update bonprelevement.class.php 2017-05-31 19:07:39 +02:00
Maxime Kohlhaas
510b1aedcf Fix xml SEPA $ListOfFactures not used and was listing all invoices in each XML line 2017-05-30 16:13:49 +02:00
Maxime Kohlhaas
200f4010d8 Fix special char and size limit in SEPA XML 2017-05-30 16:00:39 +02:00
Laurent Destailleur
d7b142beb7 Merge pull request #6830 from jfefe/patch-12
Fix #6504: CVE-2017-7886
2017-05-10 23:41:19 +02:00
Laurent Destailleur
61a4382bd8 Merge pull request #6814 from fmarcet/3.9
FIX: Correction with author and validator user on orders
2017-05-10 23:11:21 +02:00
jfefe
d410a320d7 WIP #6504: CVE-2017-7886
'defaultlang' attribute was not filtered before database request which cause an SQL injection.
2017-05-10 20:32:54 +02:00
Ferran Marcet
dbcb60433b FIX: Correction with author and validator user on orders 2017-05-09 13:31:20 +02:00
Laurent Destailleur
0c9f268f99 Merge pull request #6759 from ATM-Marc/FIX_supplier_order_rang
FIX supplier order line creation with rang = 0
2017-05-04 21:06:58 +02:00
Laurent Destailleur
4adfe6de70 Merge pull request #6725 from atm-gauthier/FIX_restrictedarea_document_contact
FIX : forgotten parameter for right multicompany use
2017-05-04 09:37:24 +02:00
Marc de Lima Lucio
56e749df9f FIX: supplier order line were always created with rang = 0 2017-04-26 16:12:27 +02:00
Laurent Destailleur
a2287fd183 Add example of sql request to fix llx_product_price 2017-04-24 13:46:41 +02:00
Laurent Destailleur
587f5a76e6 Merge branch '3.9' of git@github.com:Dolibarr/dolibarr.git into 3.9 2017-04-24 12:59:51 +02:00
Laurent Destailleur
cd099bf3b1 Fix bad update of prices 2017-04-24 12:42:54 +02:00
Juanjo Menent
9bbfeed1bc Merge pull request #6722 from Christian-Seiler/3.9
Fix #5911 Added missing Slashes
2017-04-16 12:23:52 +02:00
Christian Seiler
e23a44bcdf Added missing Slashes
fixed line where two slashes were missing, that caused an error when creating barcodes.
2017-04-16 11:09:18 +02:00
Laurent Destailleur
72ff353e9f Fix repair of product_stock 2017-04-15 16:22:15 +02:00
Laurent Destailleur
2e759d5156 Merge branch '3.9' of git@github.com:Dolibarr/dolibarr.git into 3.9 2017-04-15 16:19:02 +02:00
Laurent Destailleur
086fa4385f Fix clean of product_batch 2017-04-15 16:17:22 +02:00
gauthier
30d58f77db FIX : forgotten parameter for right multicompany use 2017-04-11 11:33:05 +02:00
Laurent Destailleur
44302f1aea Merge pull request #6650 from atm-arnaud/FIX_total_line_on_list_facture
Fix total line on list facture
2017-04-06 21:11:32 +02:00
arnaud
6b2d8a3c34 FIX limit+1 dosn't show Total line 2017-04-06 11:14:15 +02:00
arnaud
ef7a334414 Merge branch '3.9' of github.com:Dolibarr/dolibarr into 3.9_dolibarr 2017-04-04 14:56:33 +02:00
arnaud
ddbd6c371d MERGE DEGUEU 2017-01-20 11:58:30 +01:00
21 changed files with 133 additions and 65 deletions

View File

@@ -10,7 +10,7 @@ php:
- '5.3'
- '5.4'
- '5.5'
- '5.6'
- '5.6.29'
- '7.0'
- nightly
@@ -126,10 +126,10 @@ before_script:
echo "Set timezone"
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
echo
echo "Enabling APC for PHP <= 5.4"
#echo
#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!
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 "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!

View File

@@ -9,7 +9,7 @@
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016-2017 Ferran Marcet <fmarcet@2byte.es>
*
* 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
@@ -134,6 +134,7 @@ class Commande extends CommonOrder
var $linked_objects=array();
var $user_author_id;
var $user_valid;
/**
* @var OrderLine[]
@@ -1460,7 +1461,7 @@ class Commande extends CommonOrder
// Check parameters
if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
$sql = 'SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_statut';
$sql = 'SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_statut';
$sql.= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason';
$sql.= ', c.fk_account';
$sql.= ', c.date_commande';
@@ -1502,6 +1503,7 @@ class Commande extends CommonOrder
$this->socid = $obj->fk_soc;
$this->statut = $obj->fk_statut;
$this->user_author_id = $obj->fk_user_author;
$this->user_valid = $obj->fk_user_valid;
$this->total_ht = $obj->total_ht;
$this->total_tva = $obj->total_tva;
$this->total_localtax1 = $obj->total_localtax1;
@@ -2692,8 +2694,8 @@ class Commande extends CommonOrder
$sql.= " total_ht=".(isset($this->total_ht)?$this->total_ht:"null").",";
$sql.= " total_ttc=".(isset($this->total_ttc)?$this->total_ttc:"null").",";
$sql.= " fk_statut=".(isset($this->statut)?$this->statut:"null").",";
$sql.= " fk_user_author=".(isset($this->user_author)?$this->user_author:"null").",";
$sql.= " fk_user_valid=".(isset($this->fk_user_valid)?$this->fk_user_valid:"null").",";
$sql.= " fk_user_author=".(isset($this->user_author_id)?$this->user_author_id:"null").",";
$sql.= " fk_user_valid=".(isset($this->user_valid)?$this->user_valid:"null").",";
$sql.= " fk_projet=".(isset($this->fk_project)?$this->fk_project:"null").",";
$sql.= " fk_cond_reglement=".(isset($this->cond_reglement_id)?$this->cond_reglement_id:"null").",";
$sql.= " fk_mode_reglement=".(isset($this->mode_reglement_id)?$this->mode_reglement_id:"null").",";

View File

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

View File

@@ -771,7 +771,7 @@ if (empty($reshook))
$line->fk_parent_line = $fk_parent_line;
$line->subprice =-$line->subprice; // invert price for object
$line->pa_ht = -$line->pa_ht;
$line->pa_ht = $line->pa_ht;
$line->total_ht=-$line->total_ht;
$line->total_tva=-$line->total_tva;
$line->total_ttc=-$line->total_ttc;

View File

@@ -4,6 +4,7 @@
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2017 Frédéric France <frederic.france@netlogic.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
@@ -164,6 +165,6 @@ else
print $langs->trans("ErrorUnknown");
}
$db->close();
llxFooter();
$db->close();

View File

@@ -551,7 +551,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= $db->plimit($limit+1,$offset);
$sql.= $db->plimit($limit + 1,$offset);
//print $sql;
$resql = $db->query($sql);
@@ -591,7 +591,6 @@ if ($resql)
$i = 0;
print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$massactionbutton,$num,$nbtotalofrecords,'title_accountancy.png');
if ($massaction == 'presend')

View File

@@ -1265,18 +1265,6 @@ class BonPrelevement extends CommonObject
* section Debiteur (sepa Debiteurs bloc lines)
*/
$tmp_invoices = array();
$sql = "SELECT f.facnumber as fac FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."prelevement_facture as pf, ".MAIN_DB_PREFIX."societe as soc, ".MAIN_DB_PREFIX."c_country as p, ".MAIN_DB_PREFIX."societe_rib as rib WHERE pl.fk_prelevement_bons = ".$this->id." AND pl.rowid = pf.fk_prelevement_lignes AND pf.fk_facture = f.rowid AND soc.fk_pays = p.rowid AND soc.rowid = f.fk_soc AND rib.fk_soc = f.fk_soc AND rib.default_rib = 1";
$resql=$this->db->query($sql);
if ($resql) {
while ($objfac = $this->db->fetch_object($resql)) {
$tmp_invoices[] = $objfac->fac;
}
}
$ListOfFactures = implode($tmp_invoices);
$sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
$sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
$sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum";
@@ -1303,7 +1291,7 @@ class BonPrelevement extends CommonObject
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
$fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $ListOfFactures, $obj->idfac, $obj->iban, $obj->bic, $this->db->jdate($obj->datec), $obj->drum);
$fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->fac, $obj->idfac, $obj->iban, $obj->bic, $this->db->jdate($obj->datec), $obj->drum);
$this->total = $this->total + $obj->somme;
$i++;
}
@@ -1574,11 +1562,11 @@ class BonPrelevement extends CommonObject
$XML_DEBITOR .=' </FinInstnId>'.$CrLf;
$XML_DEBITOR .=' </DbtrAgt>'.$CrLf;
$XML_DEBITOR .=' <Dbtr>'.$CrLf;
$XML_DEBITOR .=' <Nm>'.strtoupper(dol_string_unaccent($row_nom)).'</Nm>'.$CrLf;
$XML_DEBITOR .=' <Nm>'.strtoupper(dolEscapeXML(dol_string_unaccent($row_nom))).'</Nm>'.$CrLf;
$XML_DEBITOR .=' <PstlAdr>'.$CrLf;
$XML_DEBITOR .=' <Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
$XML_DEBITOR .=' <AdrLine>'.dol_string_unaccent(strtr($row_address, array(CHR(13) => ", ", CHR(10) => ""))).'</AdrLine>'.$CrLf;
$XML_DEBITOR .=' <AdrLine>'.dol_string_unaccent($row_zip.' '.$row_town).'</AdrLine>'.$CrLf;
$XML_DEBITOR .=' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_unaccent(strtr($row_address, array(CHR(13) => ", ", CHR(10) => "")))),70,'right','UTF-8',true).'</AdrLine>'.$CrLf;
$XML_DEBITOR .=' <AdrLine>'.dolEscapeXML(dol_string_unaccent($row_zip.' '.$row_town)).'</AdrLine>'.$CrLf;
$XML_DEBITOR .=' </PstlAdr>'.$CrLf;
$XML_DEBITOR .=' </Dbtr>'.$CrLf;
$XML_DEBITOR .=' <DbtrAcct>'.$CrLf;

View File

@@ -39,7 +39,7 @@ $confirm = GETPOST('confirm', 'alpha');
// Security check
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'contact', $id, '','');
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
// Get parameters
$sortfield = GETPOST("sortfield",'alpha');

View File

@@ -1601,8 +1601,8 @@ class Contrat extends CommonObject
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used
{
$contractline = new ContratLigne($this->db);
$contractline->array_options=$array_option;
$contractline->id= $this->db->last_insert_id(MAIN_DB_PREFIX.$contractline->table_element);
$contractline->array_options=$array_options;
$contractline->id= $rowid;
$result=$contractline->insertExtraFields();
if ($result < 0)
{

View File

@@ -439,7 +439,7 @@ class Translate
if (! $found)
{
// Overwrite translation with database read
$sql="SELECT transkey, transvalue FROM ".MAIN_DB_PREFIX."overwrite_trans where lang='".$this->defaultlang."'";
$sql="SELECT transkey, transvalue FROM ".MAIN_DB_PREFIX."overwrite_trans where lang='".$db->escape($this->defaultlang)."'";
$resql=$db->query($sql);
if ($resql)

View File

@@ -2,6 +2,7 @@
/* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
*
* 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
@@ -407,7 +408,7 @@ function dol_get_next_week($day, $week, $month, $year)
{
$tmparray = dol_get_first_day_week($day, $month, $year);
$time=dol_mktime(12,0,0,$month,$tmparray['first_day'],$year,1,0);
$time=dol_mktime(12,0,0,$tmparray['first_month'],$tmparray['first_day'],$tmparray['first_year'],1,0);
$time+=24*60*60*7;
$tmparray=dol_getdate($time,true);

View File

@@ -1074,7 +1074,7 @@ function check_value($mask,$value)
// If an offset is asked
if (! empty($reg[2]) && preg_match('/^\+/',$reg[2])) $maskoffset=preg_replace('/^\+/','',$reg[2]);
if (! empty($reg[3]) && preg_match('^\+',$reg[3])) $maskoffset=preg_replace('/^\+/','',$reg[3]);
if (! empty($reg[3]) && preg_match('/^\+/',$reg[3])) $maskoffset=preg_replace('/^\+/','',$reg[3]);
// Define $sqlwhere

View File

@@ -762,7 +762,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
// Time spent by user
print '<td align="right">';
$tmptimespent=$taskstatic->getSummaryOfTimeSpent();
$tmptimespent=$taskstatic->getSummaryOfTimeSpent('', $fuser->id);
if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'],'allhourmin');
else print '--:--';
print "</td>\n";

View File

@@ -1099,6 +1099,7 @@ class CommandeFournisseur extends CommonOrder
$this->lines[$i]->remise_percent,
'HT',
0,
$this->lines[$i]->product_type,
$this->lines[$i]->info_bits
);
if ($result < 0)
@@ -1372,10 +1373,13 @@ class CommandeFournisseur extends CommonOrder
$localtax2_type=$localtaxes_type[2];
$subprice = price2num($pu,'MU');
$rangmax = $this->line_max();
$rang = $rangmax + 1;
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseurdet";
$sql.= " (fk_commande, label, description, date_start, date_end,";
$sql.= " fk_product, product_type,";
$sql.= " fk_product, product_type, rang,";
$sql.= " qty, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, remise_percent, subprice, ref,";
$sql.= " total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, fk_unit";
$sql.= ")";
@@ -1384,7 +1388,7 @@ class CommandeFournisseur extends CommonOrder
$sql.= " ".($date_end?"'".$this->db->idate($date_end)."'":"null").",";
if ($fk_product) { $sql.= $fk_product.","; }
else { $sql.= "null,"; }
$sql.= "'".$product_type."',";
$sql.= "'".$product_type."', ".$rang.",";
$sql.= "'".$qty."', ".$txtva.", ".$txlocaltax1.", ".$txlocaltax2;
$sql.= ", '".$localtax1_type."',";

View File

@@ -3,7 +3,7 @@
* Copyright (C) 2012-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2016 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2014-2017 Ferran Marcet <fmarcet@2byte.es>
*
* 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
@@ -39,7 +39,6 @@ require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php';
$myparam = GETPOST("myparam");
$action=GETPOST('action', 'alpha');
$id=GETPOST('id', 'int');
$userid = GETPOST('userid')?GETPOST('userid'):$user->id;
// Protection if external user
if ($user->societe_id > 0) accessforbidden();
@@ -57,7 +56,8 @@ if ($action == 'create')
$cp = new Holiday($db);
// If no right to create a request
if (($userid == $user->id && empty($user->rights->holiday->write)) || ($userid != $user->id && empty($user->rights->holiday->write_all)))
$fuserid = GETPOST('fuserid');
if (($fuserid == $user->id && empty($user->rights->holiday->write)) || ($fuserid != $user->id && empty($user->rights->holiday->write_all)))
{
$error++;
setEventMessages($langs->trans('CantCreateCP'), null, 'errors');
@@ -82,7 +82,6 @@ if ($action == 'create')
$valideur = GETPOST('valideur');
$description = trim(GETPOST('description'));
$userID = GETPOST('userID');
// If no type
if ($type <= 0)
@@ -112,7 +111,7 @@ if ($action == 'create')
}
// Check if there is already holiday for this period
$verifCP = $cp->verifDateHolidayCP($userID, $date_debut, $date_fin, $halfday);
$verifCP = $cp->verifDateHolidayCP($fuserid, $date_debut, $date_fin, $halfday);
if (! $verifCP)
{
header('Location: '.$_SERVER["PHP_SELF"].'?action=request&error=alreadyCP');
@@ -140,7 +139,7 @@ if ($action == 'create')
if (! $error)
{
$cp->fk_user = $userid;
$cp->fk_user = $fuserid;
$cp->description = $description;
$cp->date_debut = $date_debut;
$cp->date_fin = $date_fin;
@@ -682,7 +681,7 @@ llxHeader(array(),$langs->trans('CPTitreMenu'));
if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create')
{
// Si l'utilisateur n'a pas le droit de faire une demande
if (($userid == $user->id && empty($user->rights->holiday->write)) || ($userid != $user->id && empty($user->rights->holiday->write_all)))
if (($fuserid == $user->id && empty($user->rights->holiday->write)) || ($fuserid != $user->id && empty($user->rights->holiday->write_all)))
{
$errors[]=$langs->trans('CantCreateCP');
}
@@ -762,7 +761,6 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
// Formulaire de demande
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" onsubmit="return valider()" name="demandeCP">'."\n";
print '<input type="hidden" name="action" value="create" />'."\n";
print '<input type="hidden" name="userID" value="'.$userid.'" />'."\n";
dol_fiche_head();
@@ -793,10 +791,10 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
print '<td>';
if (empty($user->rights->holiday->write_all))
{
print $form->select_dolusers($userid, 'useridbis', 0, '', 1, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
print '<input type="hidden" name="userid" value="'.$userid.'">';
print $form->select_dolusers($fuserid, 'useridbis', 0, '', 1, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
print '<input type="hidden" name="fuserid" value="'.($fuserid?$fuserid:$user->id).'">';
}
else print $form->select_dolusers(GETPOST('userid')?GETPOST('userid'):$user->id,'userid',0,'',0);
else print $form->select_dolusers(GETPOST('fuserid')?GETPOST('fuserid'):$user->id,'fuserid',0,'',0);
print '</td>';
print '</tr>';

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 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 allow_comments tinyint NOT NULL DEFAULT 1;
-- ALTER TABLE llx_opensurvey_sondage DROP COLUMN survey_link_visible;
@@ -189,9 +204,14 @@ CREATE TABLE llx_payment_salary (
fk_user_modif integer
)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 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 CONSTRAINT fk_expeditiondet_batch_fk_expeditiondet FOREIGN KEY (fk_expeditiondet) REFERENCES llx_expeditiondet(rowid);

View File

@@ -611,3 +611,7 @@ INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (14
-- VMYSQL4.1 ALTER TABLE llx_c_type_resource CHANGE COLUMN rowid rowid integer NOT NULL AUTO_INCREMENT;
ALTER TABLE llx_import_model MODIFY COLUMN type varchar(50);
-- Negative buying prices
UPDATE llx_facturedet SET buy_price_ht = ABS(buy_price_ht)

View File

@@ -257,3 +257,14 @@ delete from llx_commande_fournisseur_dispatch where fk_commandefourndet = 0 or f
delete from llx_menu where menu_handler = 'smartphone';
-- Clean product prices
--delete from llx_product_price where date_price between '2017-04-20 06:51:00' and '2017-04-20 06:51:05';
-- Set product prices into llx_product with last price into llx_product_prices
--update llx_product as p set
-- p.price = (select pp.price from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1),
-- p.price_ttc = (select pp.price_ttc from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1),
-- p.price_min = (select pp.price_min from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1),
-- p.price_min_ttc = (select pp.price_min_ttc from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1),
-- p.tva_tx = 0
-- where price = 17.5

View File

@@ -75,8 +75,8 @@ print '<h3>'.$langs->trans("Repair").'</h3>';
print 'Option restore_thirdparties_logos is '.(GETPOST('restore_thirdparties_logos')?GETPOST('restore_thirdparties_logos'):'0').'<br>'."\n";
print 'Option clean_linked_elements is '.(GETPOST('clean_linked_elements')?GETPOST('clean_linked_elements'):'0').'<br>'."\n";
print 'Option clean_orphelin_dir (1 or confirmed) is '.(GETPOST('clean_orphelin_dir')?GETPOST('clean_orphelin_dir'):'0').'<br>'."\n";
print 'Option clean_product_stock_batch (1 or confirmed) is '.(GETPOST('clean_product_stock_batch')?GETPOST('clean_product_stock_batch'):'0').'<br>'."\n";
print 'Option clean_orphelin_dir (0 or \'test\' or \'confirmed\') is '.(GETPOST('clean_orphelin_dir')?GETPOST('clean_orphelin_dir'):'0').'<br>'."\n";
print 'Option clean_product_stock_batch (0 or \'test\' or \'confirmed\') is '.(GETPOST('clean_product_stock_batch')?GETPOST('clean_product_stock_batch'):'0').'<br>'."\n";
print '<br>';
print '<table cellspacing="0" cellpadding="1" border="0" width="100%">';
@@ -523,14 +523,17 @@ if ($ok && GETPOST('clean_orphelin_dir'))
// clean_linked_elements: Check and clean linked elements
if ($ok && GETPOST('clean_product_stock_batch'))
{
print '<tr><td colspan="2"><br>Clean table product_batch</td></tr>';
$methodtofix=GETPOST('methodtofix')?GETPOST('methodtofix'):'updatestock';
print '<tr><td colspan="2"><br>Clean table product_batch, methodtofix='.$methodtofix.' (possible values: updatestock or updatebatch)</td></tr>';
$sql ="SELECT p.rowid, p.ref, p.tobatch, ps.rowid as psrowid, ps.fk_entrepot, ps.reel, SUM(pb.qty) as reelbatch";
$sql.=" FROM ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product_batch as pb";
$sql.=" WHERE p.rowid = ps.fk_product AND ps.rowid = pb.fk_product_stock";
$sql.=" FROM ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."product_stock as ps LEFT JOIN ".MAIN_DB_PREFIX."product_batch as pb ON ps.rowid = pb.fk_product_stock";
$sql.=" WHERE p.rowid = ps.fk_product";
$sql.=" AND p.tobatch = 1";
$sql.=" GROUP BY p.rowid, p.ref, p.tobatch, ps.rowid, ps.fk_entrepot, ps.reel";
$sql.=" HAVING reel != SUM(pb.qty)";
$sql.=" HAVING reel != SUM(pb.qty) or SUM(pb.qty) IS NULL";
print $sql;
$resql = $db->query($sql);
if ($resql)
{
@@ -542,13 +545,11 @@ if ($ok && GETPOST('clean_product_stock_batch'))
while ($i < $num)
{
$obj=$db->fetch_object($resql);
print '<tr><td>'.$obj->rowid.'-'.$obj->ref.'-'.$obj->fk_entrepot.' -> '.$obj->psrowid.': '.$obj->reel.' != '.$obj->reelbatch;
print '<tr><td>Product '.$obj->rowid.'-'.$obj->ref.' in warehose '.$obj->fk_entrepot.' -> '.$obj->psrowid.': '.$obj->reel.' (product_stock.reel) != '.($obj->reelbatch?$obj->reelbatch:'0').' (sum product_batch)';
// Fix
if ($obj->reel != $obj->reelbatch)
{
$methodtofix='updatestock';
if ($methodtofix == 'updatebatch')
{
// Method 1
@@ -570,7 +571,7 @@ if ($ok && GETPOST('clean_product_stock_batch'))
if ($methodtofix == 'updatestock')
{
// Method 2
print ' -> Update qty of stock with qty = '.$obj->reelbatch.' for ps.rowid = '.$obj->psrowid;
print ' -> Update qty of product_stock with qty = '.($obj->reelbatch?$obj->reelbatch:'0').' for ps.rowid = '.$obj->psrowid;
if (GETPOST('clean_product_stock_batch') == 'confirmed')
{
$error=0;
@@ -578,11 +579,11 @@ if ($ok && GETPOST('clean_product_stock_batch'))
$db->begin();
$sql2 ="UPDATE ".MAIN_DB_PREFIX."product_stock";
$sql2.=" SET reel = ".$obj->reelbatch." WHERE rowid = ".$obj->psrowid;
$sql2.=" SET reel = ".($obj->reelbatch?$obj->reelbatch:'0')." WHERE rowid = ".$obj->psrowid;
$resql2=$db->query($sql2);
if ($resql2)
{
// We update product stock, so we must update product.stock too.
// We update product_stock, so we must field stock into product too.
$sql3='UPDATE llx_product p SET p.stock= (SELECT SUM(ps.reel) FROM llx_product_stock ps WHERE ps.fk_product = p.rowid)';
$resql3=$db->query($sql3);
if (! $resql3)
@@ -608,6 +609,10 @@ if ($ok && GETPOST('clean_product_stock_batch'))
$i++;
}
}
else
{
print '<tr><td colspan="2">Nothing to do</td></tr>';
}
}
else
{
@@ -618,6 +623,34 @@ if ($ok && GETPOST('clean_product_stock_batch'))
}
// clean_linked_elements: Check and clean linked elements
if ($ok && GETPOST('clean_product_stock_negative_if_batch'))
{
print '<tr><td colspan="2"><br>Clean table product_batch, methodtofix='.$methodtofix.' (possible values: updatestock or updatebatch)</td></tr>';
$sql ="SELECT p.rowid, p.ref, p.tobatch, ps.rowid as psrowid, ps.fk_entrepot, ps.reel, SUM(pb.qty) as reelbatch";
$sql.=" FROM ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product_batch as pb";
$sql.=" WHERE p.rowid = ps.fk_product AND ps.rowid = pb.fk_product_stock";
$sql.=" AND p.tobatch = 1";
$sql.=" GROUP BY p.rowid, p.ref, p.tobatch, ps.rowid, ps.fk_entrepot, ps.reel";
$sql.=" HAVING reel != SUM(pb.qty)";
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
if ($num)
{
$i = 0;
while ($i < $num)
{
$obj=$db->fetch_object($resql);
print '<tr><td>'.$obj->rowid.'-'.$obj->ref.'-'.$obj->fk_entrepot.' -> '.$obj->psrowid.': '.$obj->reel.' != '.$obj->reelbatch;
}
}
}
}

View File

@@ -42,8 +42,6 @@ $oldvatrate=GETPOST('oldvatrate');
$newvatrate=GETPOST('newvatrate');
//$price_base_type=GETPOST('price_base_type');
$objectstatic = new Product($db);
$objectstatic2 = new ProductFournisseur($db);
/*
@@ -87,6 +85,7 @@ if ($action == 'convert')
{
$obj = $db->fetch_object($resql);
$objectstatic = new Product($db); // Object init must be into loop to avoid to get value of previous step
$ret=$objectstatic->fetch($obj->rowid);
if ($ret > 0)
{
@@ -150,7 +149,8 @@ if ($action == 'convert')
if ($ret < 0 || $retm < 0) $error++;
else $nbrecordsmodified++;
}
unset($objectstatic);
$i++;
}
}
@@ -176,6 +176,7 @@ if ($action == 'convert')
{
$obj = $db->fetch_object($resql);
$objectstatic2 = new ProductFournisseur($db); // Object init must be into loop to avoid to get value of previous step
$ret=$objectstatic2->fetch_product_fournisseur_price($obj->rowid);
if ($ret > 0)
{
@@ -207,6 +208,8 @@ if ($action == 'convert')
if ($ret < 0 || $retm < 0) $error++;
else $nbrecordsmodified++;
}
unset($objectstatic2);
$i++;
}
}

View File

@@ -911,9 +911,10 @@ class Task extends CommonObject
* Calculate total of time spent for task
*
* @param int $id Id of object (here task)
* @param int $user_id Filter on user time
* @return array Array of info for task array('min_date', 'max_date', 'total_duration')
*/
function getSummaryOfTimeSpent($id='')
function getSummaryOfTimeSpent($id='', $user_id='')
{
global $langs;
@@ -927,6 +928,7 @@ class Task extends CommonObject
$sql.= " SUM(t.task_duration) as total_duration";
$sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t";
$sql.= " WHERE t.fk_task = ".$id;
if(!empty($user_id)) $sql.= " AND t.fk_user = ".$user_id;
dol_syslog(get_class($this)."::getSummaryOfTimeSpent", LOG_DEBUG);
$resql=$this->db->query($sql);