diff --git a/.travis.yml b/.travis.yml
index b2bfebd91db..efa6b3f28fc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,14 +3,21 @@
# Command run is phpunit
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/
+notifications:
+ email:
+ on_success: never # [always|never|change] default: change
+ on_failure: always # [always|never|change] default: always
+
services:
- memcached # will start memcached
# This will tell travis to run phpunit
language: php
php:
+# - "5.2" is not supported because pyrus to install PHP_Codesniffer is not available
- "5.3"
- "5.4"
+ - "5.5"
env:
- DB=mysql
@@ -20,7 +27,9 @@ before_script:
- echo Start travis
- echo Current dir is `pwd`
- echo Home dir is `echo ~`
- - echo Update composer
+ - export PHPV=`phpenv version-name`
+ - echo PHP version $PHPV
+# - echo Update composer
# - ~/.phpenv/versions/$(phpenv version-name)/bin/composer.phar self-update
- echo Install phpcs then show installed rules
- pyrus install pear/PHP_CodeSniffer
@@ -35,10 +44,12 @@ before_script:
- find $(pwd)/htdocs/documents -type d -exec ls -alt {} \;
- echo Edit php.ini file
- echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- - echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
# - echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- - echo "zend_extension_ts = xdebug.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
+ - sh -c "if [ '$PHPV' = '5.3' ]; then echo 'extension = apc.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi"
+ - sh -c "if [ '$PHPV' = '5.4' ]; then echo 'extension = apc.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi"
+ - sh -c "if [ '$PHPV' = '5.3' ]; then echo 'zend_extension_ts = xdebug.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi"
+ - sh -c "if [ '$PHPV' = '5.4' ]; then echo 'zend_extension_ts = xdebug.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi"
- cat ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- echo Init database
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS myapp_test;' -U postgres; fi"
diff --git a/ChangeLog b/ChangeLog
index 15b50425f45..00a99cef973 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -63,6 +63,7 @@ For users:
- Fix: [bug #1022] correct margin calculation for credit notes.
- New: Can choose contact on event (action com) creation, and filtred by thirdparty.
- New: Add hidden option MAIN_FORCE_DEFAULT_STATE_ID.
+- New: Add page to make mass stock movement.
For translators:
- Qual: Normalized sort order of all languages files with english reference files.
diff --git a/htdocs/install/mysql/tables/llx_actioncomm.sql b/htdocs/install/mysql/tables/llx_actioncomm.sql
index ea70aa02385..906188d8ceb 100644
--- a/htdocs/install/mysql/tables/llx_actioncomm.sql
+++ b/htdocs/install/mysql/tables/llx_actioncomm.sql
@@ -44,9 +44,9 @@ create table llx_actioncomm
fk_contact integer,
fk_parent integer NOT NULL default 0,
- fk_user_action integer, -- user id of owner of action (currently also user id of actor that must do action. In future, actors assigned to action will be an array into table llx_actioncomm_actors)
+ fk_user_action integer, -- user id of owner of action (currently also user id of actor that must do action. In future, actors assigned to action will be an array into table llx_actioncomm_resources)
- transparency integer, -- transparency (ical standard). used to say if people assigned to event are busy or not by event (in future version, this field is deprecated and will be stored into table llx_actioncomm_actors)
+ transparency integer, -- transparency (ical standard). used to say if people assigned to event are busy or not by event (in future version, this field is deprecated and will be stored into table llx_actioncomm_resources)
fk_user_done integer, -- user id of people that has made action (deprecated)
priority smallint,
diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang
index f111648f0e9..69c31ac148b 100644
--- a/htdocs/langs/en_US/compta.lang
+++ b/htdocs/langs/en_US/compta.lang
@@ -168,3 +168,5 @@ CalculationRuleDesc=To calculate total VAT, there is two methods:
Method 1 is
CalculationRuleDescSupplier=according to supplier, choose appropriate method to apply same calculation rule and get same result expected by your supplier.
TurnoverPerProductInCommitmentAccountingNotRelevant=Turnover report per product, when using a cash accountancy mode is not relevant. This report is only available when using engagement accountancy mode (see setup of accountancy module).
CalculationMode=Calculation mode
+COMPTA_ACCOUNT_CUSTOMER=Accountancy code by default for customer thirdparties
+COMPTA_ACCOUNT_SUPPLIER=Accountancy code by default for supplier thirdparties
diff --git a/htdocs/langs/fr_FR/compta.lang b/htdocs/langs/fr_FR/compta.lang
index f08f2ea5634..21537287456 100644
--- a/htdocs/langs/fr_FR/compta.lang
+++ b/htdocs/langs/fr_FR/compta.lang
@@ -167,4 +167,6 @@ Mode2=Mode 2
CalculationRuleDesc=Pour calculer le total de TVA, il existe 2 modes:
Le mode 1 consiste à arrondir la tva de chaque ligne et à sommer cet arrondi.
Le mode 2 consiste à sommer la tva de chaque ligne puis à l'arrondir.
Les résultats peuvent différer de quelques centimes. Le mode par défaut est le mode %s.
CalculationRuleDescSupplier=Selon le mode utilisé par le fournisseur, choisissez le mode adéquant afin d'appliquer la même règle et obtenir un résultat identique au mode appliqué par votre fournisseur.
TurnoverPerProductInCommitmentAccountingNotRelevant=Le chiffre d'affaire par produit, dans une comptabilité en mode comptabilité de caisse n'est pas définissable. Ce rapport n'est disponible qu'en mode de comptabilité dit comptabilité d'engagement (voir la configuration du module de comptabilité).
-CalculationMode=Mode de calcul
\ No newline at end of file
+CalculationMode=Mode de calcul
+COMPTA_ACCOUNT_CUSTOMER=Code comptable par défaut des tiers clients
+COMPTA_ACCOUNT_SUPPLIER=Code comptable par défaut des tiers fournisseurs
diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php
index 1ad1807d459..4e9abfcbaeb 100644
--- a/htdocs/product/stock/massstockmove.php
+++ b/htdocs/product/stock/massstockmove.php
@@ -122,12 +122,95 @@ if ($action == 'delline' && $idline != '')
else unset($_SESSION['massstockmove']);
}
-if ($action == 'createmovement' && isset($_POST['valid']))
+if ($action == 'createmovements')
{
+ $error=0;
+
+ if (! GETPOST("label"))
+ {
+ $error++;
+ setEventMessage($langs->trans("ErrorFieldRequired"),$langs->transnoentitiesnoconv("LabelMovement"));
+ }
+
+ $db->begin();
+
+ if (! $error)
+ {
+ $product = new Product($db);
+ foreach($listofdata as $key => $val) // Loop on each movement to do
+ {
+ $id=$val['id'];
+ $id_product=$val['id_product'];
+ $id_sw=$val['id_sw'];
+ $id_tw=$val['id_tw'];
+ $qty=price2num($val['qty']);
+
+ if (! $error && $id_sw <> $id_tw && is_numeric($qty) && $id_product)
+ {
+ $result=$product->fetch($id_product);
+ $product->load_stock(); // Load array product->stock_warehouse
+ // Define value of products moved
+ $pricesrc=0;
+ if (isset($product->stock_warehouse[$id_sw]->pmp)) $pricesrc=$product->stock_warehouse[$id_sw]->pmp;
+ $pricedest=$pricesrc;
+ //print 'price src='.$pricesrc.', price dest='.$pricedest;exit;
+
+ // Remove stock
+ $result1=$product->correct_stock(
+ $user,
+ $id_sw,
+ $qty,
+ 1,
+ GETPOST("label"),
+ $pricesrc
+ );
+ if ($result1 < 0)
+ {
+ $error++;
+ setEventMessage($product->errors,'errors');
+ }
+
+ // Add stock
+ $result2=$product->correct_stock(
+ $user,
+ $id_tw,
+ $qty,
+ 0,
+ GETPOST("label"),
+ $pricedest
+ );
+ if ($result2 < 0)
+ {
+ $error++;
+ setEventMessage($product->errors,'errors');
+ }
+ }
+ else
+ {
+ dol_print_error('',"Bad value saved into sessions");
+ $error++;
+ }
+ }
+ }
+
+ if (! $error)
+ {
+ unset($_SESSION['massstockmove']);
+
+ $db->commit();
+ setEventMessage($langs->trans("StockMovementRecorded"),'mesgs');
+ header("Location: ".DOL_URL_ROOT.'/product/stock/index.php'); // Redirect to avoid pb when using back
+ exit;
+ }
+ else
+ {
+ $db->rollback();
+ setEventMessage($langs->trans("Error"),'errors');
+ }
}
@@ -230,8 +313,16 @@ foreach($listofdata as $key => $val)
print '';
+print '';
+
+
print '
';
+
+print '