Merge branch '3.9' of git@github.com:Dolibarr/dolibarr.git into 3.9

This commit is contained in:
Laurent Destailleur 2016-09-02 19:03:50 +02:00
commit 696b54c6c3
2 changed files with 17 additions and 7 deletions

View File

@ -10,6 +10,7 @@
* Copyright (C) 2014 Ion agorria <ion@agorria.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016 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
@ -213,7 +214,7 @@ if (empty($reshook))
'price' => $newprice[$i],
'price_min' => $newprice_min[$i],
'price_base_type' => $newpricebase[$i],
'vat_tx' => $tva_tx,
'vat_tx' => $tva_tx_txt,
'npr' => $npr,
'localtaxes_array' => array('0'=>$localtax1_type, '1'=>$localtax1, '2'=>$localtax2_type, '3'=>$localtax2)
);

View File

@ -137,17 +137,26 @@ class MouvementStock extends CommonObject
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
if ($this->db->jdate($obj->eatby) != $eatby)
// only check date values
$tmparray=dol_getdate($eatby, true);
$eatby=dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']);
$tmparray=dol_getdate($sellby, true);
$sellby=dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']);
$tmparray=dol_getdate($this->db->jdate($obj->eatby), true);
$dbEatby=dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']);
$tmparray=dol_getdate($this->db->jdate($obj->sellby), true);
$dbSellby=dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']);
if ($dbEatby != $eatby)
{
$this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby)), dol_print_date($eatby));
dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby)), dol_print_date($eatby)), LOG_ERR);
$this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($dbEatby), dol_print_date($eatby));
dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($dbEatby), dol_print_date($eatby)), LOG_ERR);
$this->db->rollback();
return -3;
}
if ($this->db->jdate($obj->sellby) != $sellby)
if ($dbSellby != $sellby)
{
$this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby));
dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby)), LOG_ERR);
$this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($dbSellby), dol_print_date($sellby));
dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($dbSellby), dol_print_date($sellby)), LOG_ERR);
$this->db->rollback();
return -3;
}