diff --git a/dev/translation/strip_language_file.php b/dev/translation/strip_language_file.php
index d6c45d9f249..42a70c8c1a6 100755
--- a/dev/translation/strip_language_file.php
+++ b/dev/translation/strip_language_file.php
@@ -1,20 +1,20 @@
#!/usr/bin/php
- *
- * 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 2 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 .
+ * Copyright (C) 2014 Laurent Destailleur
+ *
+ * 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 2 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 .
*
* -----
*
@@ -270,8 +270,8 @@ foreach($filesToProcess as $fileToProcess)
print "Output can be found at $output.\n";
- print "To rename all .delta files, you can do\n";
- print 'for fic in `ls *.delta`; do f=`echo $fic | sed -e \'s/\.delta//\'`; echo $f; mv $f.delta $f; done'."\n";
+ print "To rename all .delta files, you can do\n";
+ print 'for fic in `ls *.delta`; do f=`echo $fic | sed -e \'s/\.delta//\'`; echo $f; mv $f.delta $f; done'."\n";
}
diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php
index 2abb2b5acad..6905156990b 100644
--- a/htdocs/admin/contract.php
+++ b/htdocs/admin/contract.php
@@ -182,30 +182,15 @@ else if ($action == 'setmod')
dolibarr_set_const($db, "CONTRACT_ADDON",$value,'chaine',0,'',$conf->entity);
}
-else if ($action == 'set_CONTRACT_FREE_TEXT')
+else if ($action == 'set_other')
{
$freetext= GETPOST('CONTRACT_FREE_TEXT','alpha');
- $res = dolibarr_set_const($db, "CONTRACT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
+ $res1 = dolibarr_set_const($db, "CONTRACT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
- if (! $res > 0) $error++;
-
- if (! $error)
- {
- setEventMessage($langs->trans("SetupSaved"));
- }
- else
- {
- setEventMessage($langs->trans("Error"),'errors');
- }
-}
-
-else if ($action == 'set_CONTRACT_DRAFT_WATERMARK')
-{
$draft= GETPOST('CONTRACT_DRAFT_WATERMARK','alpha');
+ $res2 = dolibarr_set_const($db, "CONTRACT_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
- $res = dolibarr_set_const($db, "CONTRACT_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
-
- if (! $res > 0) $error++;
+ if (! $res1 > 0 || ! $res2 > 0) $error++;
if (! $error)
{
@@ -217,6 +202,7 @@ else if ($action == 'set_CONTRACT_DRAFT_WATERMARK')
}
}
+
/*
* View
*/
@@ -506,44 +492,43 @@ print " ";
*
*/
+print '';
+
+dol_fiche_end();
-$db->close();
llxFooter();
+
+$db->close();
diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php
index 9ce93a6bc26..df9632761dd 100644
--- a/htdocs/admin/modules.php
+++ b/htdocs/admin/modules.php
@@ -525,6 +525,13 @@ else
print '
';
-
+
/*
* Boutons actions
*/
diff --git a/htdocs/install/mysql/tables/llx_entrepot.sql b/htdocs/install/mysql/tables/llx_entrepot.sql
index 1c49ac293f8..9e9bfc9c26f 100644
--- a/htdocs/install/mysql/tables/llx_entrepot.sql
+++ b/htdocs/install/mysql/tables/llx_entrepot.sql
@@ -33,7 +33,7 @@ create table llx_entrepot
fk_departement integer,
fk_pays integer DEFAULT 0,
statut tinyint DEFAULT 1, -- 1 open, 0 close
- valo_pmp float(12,4), -- valoristaion du stock en PMP
+ valo_pmp float(12,4), -- PMP value for this warehouse (deprecated. No sens for a warehouse)
fk_user_author integer,
import_key varchar(14)
)ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_product_stock.sql b/htdocs/install/mysql/tables/llx_product_stock.sql
index 5d550aadb6d..99d7d27fb77 100644
--- a/htdocs/install/mysql/tables/llx_product_stock.sql
+++ b/htdocs/install/mysql/tables/llx_product_stock.sql
@@ -25,7 +25,7 @@ create table llx_product_stock
fk_product integer NOT NULL,
fk_entrepot integer NOT NULL,
reel real, -- physical stock
- pmp double(24,8) default 0 NOT NULL, -- PMP value for product in this warehouse
+ pmp double(24,8) default 0 NOT NULL, -- PMP value for product in this warehouse (deprecated. no sens for warehouse)
import_key varchar(14) -- Import key
)ENGINE=innodb;
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 0e1be94eaba..8c737eecd52 100755
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -210,6 +210,7 @@ ModulesJobDesc=Business modules provide simple predefined setup of Dolibarr for
ModulesMarketPlaceDesc=You can find more modules to download on external web sites on the Internet...
ModulesMarketPlaces=More modules...
DoliStoreDesc=DoliStore, the official market place for Dolibarr ERP/CRM external modules
+DoliPartnersDesc=List with some companies that can provide/develop on-demand modules or features (Note: any Open Source company knowning PHP language can provide you specific development)
WebSiteDesc=Web site providers you can search to find more modules...
URL=Link
BoxesAvailable=Boxes available
@@ -446,7 +447,7 @@ Module55Desc=Barcode management
Module56Name=Telephony
Module56Desc=Telephony integration
Module57Name=Standing orders
-Module57Desc=Standing orders and withdrawal management
+Module57Desc=Standing orders and withdrawal management. Also includes generation of SEPA file for european countries.
Module58Name=ClickToDial
Module58Desc=Integration of a ClickToDial system (Asterisk, ...)
Module59Name=Bookmark4u
diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang
index 5781d5e3ac0..1cc01ec2e7b 100644
--- a/htdocs/langs/en_US/agenda.lang
+++ b/htdocs/langs/en_US/agenda.lang
@@ -29,6 +29,7 @@ ActionsToDoBy=Events assigned to
ActionsDoneBy=Events done by
ActionsForUser=Events for user
ActionsForUsersGroup=Events for all users of group
+ActionAssignedTo=Event assigned to
AllMyActions= All my events/tasks
AllActions= All events/tasks
ViewList=List view
diff --git a/htdocs/langs/en_US/contracts.lang b/htdocs/langs/en_US/contracts.lang
index 06c05e520fa..57ba3bb15d8 100644
--- a/htdocs/langs/en_US/contracts.lang
+++ b/htdocs/langs/en_US/contracts.lang
@@ -91,6 +91,7 @@ ListOfServicesToExpire=List of Services to expire
NoteListOfYourExpiredServices=This list contains only services of contracts for third parties you are linked to as a sale representative.
StandardContractsTemplate=Standard contracts template
ContactNameAndSignature=For %s, name and signature:
+OnlyLinesWithTypeServiceAreUsed=Only lines with type "Service" will be cloned.
##### Types de contacts #####
TypeContact_contrat_internal_SALESREPSIGN=Sales representative signing contract
diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang
index fd4305bbd0b..a0f8078fb18 100644
--- a/htdocs/langs/en_US/withdrawals.lang
+++ b/htdocs/langs/en_US/withdrawals.lang
@@ -79,10 +79,11 @@ CreditDate=Credit on
WithdrawalFileNotCapable=Unable to generate withdrawal receipt file for your country %s (Your country is not supported)
ShowWithdraw=Show Withdraw
IfInvoiceNeedOnWithdrawPaymentWontBeClosed=However, if invoice has at least one withdrawal payment not yet processed, it won't be set as paid to allow prior withdrawal management.
-DoStandingOrdersBeforePayments=This tab allows you to request a standing order. Once it is complete, you can type the payment to close the invoice.
+DoStandingOrdersBeforePayments=This tab allows you to request a standing order. Once donee, go into menu Bank->Withdrawal to manage the standing order. When standing order is closed, payment on invoice will be automatically recorded, and invoice closed if remainder to pay is null.
WithdrawalFile=Withdrawal file
SetToStatusSent=Set to status "File Sent"
ThisWillAlsoAddPaymentOnInvoice=This will also apply payments to invoices and will classify them as "Paid"
+StatisticsByLineStatus=Statistics by status of lines
### Notifications
InfoCreditSubject=Payment of standing order %s by the bank
diff --git a/htdocs/langs/fr_FR/agenda.lang b/htdocs/langs/fr_FR/agenda.lang
index be2e6083aa6..a4e5e7e0a03 100644
--- a/htdocs/langs/fr_FR/agenda.lang
+++ b/htdocs/langs/fr_FR/agenda.lang
@@ -29,6 +29,7 @@ ActionsToDoBy=Événements affectés à
ActionsDoneBy=Événements réalisés par
ActionsForUser=Evénements de l'utilisateur
ActionsForUsersGroup=Evénements de tous les utilisateurs du groupe
+ActionAssignedTo=Événement assigné à
AllMyActions= Tous mes événements
AllActions= Tous les événements
ViewList=Vue liste
diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php
index 6fd6d834497..b31305b448b 100644
--- a/htdocs/product/stock/card.php
+++ b/htdocs/product/stock/card.php
@@ -73,13 +73,13 @@ if ($action == 'add' && $user->rights->stock->creer)
$object->town = GETPOST("town");
$object->country_id = GETPOST("country_id");
- if (! empty($object->libelle))
+ if (! empty($object->libelle))
{
$id = $object->create($user);
if ($id > 0)
{
setEventMessage($langs->trans("RecordSaved"));
-
+
if (! empty($backtopage))
{
header("Location: ".$backtopage);
@@ -180,9 +180,9 @@ if ($action == 'create')
print '';
print '';
print '';
-
+
dol_fiche_head();
-
+
print '
';
+ $totalvalue+=price2num($objp->ppmp*$objp->value,'MT');
// Price sell min
if (empty($conf->global->PRODUIT_MULTIPRICES))
diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php
index 9e508f41461..24ca13da355 100644
--- a/htdocs/product/stock/class/mouvementstock.class.php
+++ b/htdocs/product/stock/class/mouvementstock.class.php
@@ -163,21 +163,40 @@ class MouvementStock extends CommonObject
{
$newpmp=0;
$newpmpwarehouse=0;
- // Note: PMP is calculated on stock input only (type = 0 or 3). If type == 0 or 3, qty should be > 0.
+ // Note: PMP is calculated on stock input only (type of movement = 0 or 3). If type == 0 or 3, qty should be > 0.
// Note: Price should always be >0 or 0. PMP should be always >0 (calculated on input)
if (($type == 0 || $type == 3) && $price > 0)
{
+ // If we will change PMP for the warehouse we edit and the product, we must first check/clean that PMP is defined
+ // on every stock entry with old value (so global updated value will match recalculated value from product_stock)
+ $sql = "UPDATE ".MAIN_DB_PREFIX."product_stock SET pmp = ".($oldpmp?$oldpmp:'0');
+ $sql.= " WHERE pmp = 0 AND fk_product = ".$fk_product;
+ dol_syslog(get_class($this)."::_create", LOG_DEBUG);
+ $resql=$this->db->query($sql);
+ if (! $resql)
+ {
+ $this->error=$this->db->lasterror();
+ $error = -4;
+ }
+
$oldqtytouse=($oldqty >= 0?$oldqty:0);
// We make a test on oldpmp>0 to avoid to use normal rule on old data with no pmp field defined
if ($oldpmp > 0) $newpmp=price2num((($oldqtytouse * $oldpmp) + ($qty * $price)) / ($oldqtytouse + $qty), 'MU');
- else $newpmp=$price;
- $oldqtywarehousetouse=($oldqtywarehouse >= 0?$oldqtywarehouse:0);
+ else
+ {
+ $newpmp=$price; // For this product, PMP was not yet set. We will set it later.
+ }
+ $oldqtywarehousetouse=$oldqtywarehouse;
if ($oldpmpwarehouse > 0) $newpmpwarehouse=price2num((($oldqtywarehousetouse * $oldpmpwarehouse) + ($qty * $price)) / ($oldqtywarehousetouse + $qty), 'MU');
else $newpmpwarehouse=$price;
- //print "oldqtytouse=".$oldqtytouse." oldpmp=".$oldpmp." oldqtywarehousetouse=".$oldqtywarehousetouse." oldpmpwarehouse=".$oldpmpwarehouse." ";
- //print "qty=".$qty." newpmp=".$newpmp." newpmpwarehouse=".$newpmpwarehouse;
- //exit;
+ /*print "oldqtytouse=".$oldqtytouse." oldpmp=".$oldpmp." oldqtywarehousetouse=".$oldqtywarehousetouse." oldpmpwarehouse=".$oldpmpwarehouse." ";
+ print "qty=".$qty." newpmp=".$newpmp." newpmpwarehouse=".$newpmpwarehouse;
+ exit;*/
+ }
+ else if ($type == 1 || $type == 2)
+ {
+ // After a stock decrease, we don't change value of PMP for product.
}
else
{
@@ -207,14 +226,17 @@ class MouvementStock extends CommonObject
{
$this->error=$this->db->lasterror();
$error = -3;
- } else if(empty($fk_product_stock)){
+ }
+ else if(empty($fk_product_stock))
+ {
$fk_product_stock = $this->db->last_insert_id(MAIN_DB_PREFIX."product_stock");
}
- }
+ }
// Update detail stock for sell-by date
- if (($product->hasbatch()) && (! $error) && (! $skip_sellby)){
+ if (($product->hasbatch()) && (! $error) && (! $skip_sellby))
+ {
$param_batch=array('fk_product_stock' =>$fk_product_stock, 'eatby'=>$eatby,'sellby'=>$sellby,'batchnumber'=>$batch);
$result=$this->_create_batch($param_batch, $qty);
if ($result<0) $error++;
@@ -245,7 +267,6 @@ class MouvementStock extends CommonObject
if ($movestock && ! $error)
{
-
$this->product_id = $fk_product;
$this->entrepot_id = $entrepot_id;
$this->qty = $qty;
diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php
index c55466ebdb1..c85c501fa58 100644
--- a/htdocs/product/stock/list.php
+++ b/htdocs/product/stock/list.php
@@ -52,7 +52,7 @@ $year = strftime("%Y",time());
*/
$sql = "SELECT e.rowid, e.label as ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays,";
-$sql.= " SUM(ps.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue";
+$sql.= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue";
$sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid";
diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php
index 59561da32ea..b7eb79e5ab7 100644
--- a/htdocs/product/stock/product.php
+++ b/htdocs/product/stock/product.php
@@ -122,10 +122,11 @@ if ($action == "correct_stock" && ! $cancel)
if (is_numeric(GETPOST("nbpiece")) && $id)
{
if (empty($product)) {
- $product = new Product($db);
- $result=$product->fetch($id);
+ $product = new Product($db);
+ $result=$product->fetch($id);
}
- if ($product->hasbatch()) {
+ if ($product->hasbatch())
+ {
$d_eatby=dol_mktime(12, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']);
$d_sellby=dol_mktime(12, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']);
$result=$product->correct_stock_batch(
@@ -139,15 +140,17 @@ if ($action == "correct_stock" && ! $cancel)
$d_sellby,
GETPOST('batch_number')
); // We do not change value of stock for a correction
- } else {
- $result=$product->correct_stock(
- $user,
- GETPOST("id_entrepot"),
- GETPOST("nbpiece"),
- GETPOST("mouvement"),
- GETPOST("label"),
- $priceunit
- ); // We do not change value of stock for a correction
+ }
+ else
+ {
+ $result=$product->correct_stock(
+ $user,
+ GETPOST("id_entrepot"),
+ GETPOST("nbpiece"),
+ GETPOST("mouvement"),
+ GETPOST("label"),
+ $priceunit
+ ); // We do not change value of stock for a correction
}
if ($result > 0)
@@ -636,9 +639,9 @@ if ($resql)
print '
'; // Ditto : Show PMP from movement or from product
// Sell price
print '
';
if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($product->price,'MU'),1);
@@ -650,15 +653,15 @@ if ($resql)
else print $langs->trans("Variable");
print '
'; ;
$total += $obj->reel;
- if (price2num($obj->pmp)) $totalwithpmp += $obj->reel;
- $totalvalue = $totalvalue + price2num($obj->pmp*$obj->reel,'MU'); // Ditto : Show PMP from movement or from product
- $totalvaluesell = $totalvaluesell + price2num($product->price*$obj->reel,'MU'); // Ditto : Show PMP from movement or from product
+ if (price2num($product->pmp)) $totalwithpmp += $obj->reel;
+ $totalvalue = $totalvalue + ($product->pmp*$obj->reel); // Ditto : Show PMP from movement or from product
+ $totalvaluesell = $totalvaluesell + ($product->price*$obj->reel); // Ditto : Show PMP from movement or from product
//Batch Detail
- if ((! empty($conf->productbatch->enabled)) && $product->hasbatch())
+ if ((! empty($conf->productbatch->enabled)) && $product->hasbatch())
{
$details=Productbatch::findAll($db,$obj->product_stock_id);
if ($details<0) dol_print_error($db);
- foreach ($details as $pdluo)
+ foreach ($details as $pdluo)
{
print "\n".'
';
-print ($totalwithpmp?price($totalvalue/$totalwithpmp):' ');
+print ($totalwithpmp?price(price2num($totalvalue/$totalwithpmp,'MU')):' '); // This value may have rounding errors
print '