diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php
index 651335d0a6d..0c4df916943 100644
--- a/htdocs/admin/translation.php
+++ b/htdocs/admin/translation.php
@@ -367,6 +367,14 @@ if ($mode == 'searchkey')
foreach($filearray as $file)
{
$tmpfile=preg_replace('/.lang/i', '', basename($file['name']));
+ //Detect if trans coming from extranl module
+ foreach ($conf->file->dol_document_root as $keyconf=>$dirconfalt) {
+ if (($keyconf!='main') && (preg_match('$'.preg_quote($dirconfalt).'$i', $file['fullname']))) {
+ //In this case load modulename@nmodulename
+ $tmpfile=$tmpfile.'@'.$tmpfile;
+ break;
+ }
+ }
$newlang->load($tmpfile, 0, 0, '', 0); // Load translation files + database overwrite
$newlangfileonly->load($tmpfile, 0, 0, '', 1); // Load translation files only
//print 'After loading lang '.$tmpfile.', newlang has '.count($newlang->tab_translate).' records
'."\n";
diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php
index 7c5b99e2945..729700093e6 100644
--- a/htdocs/compta/paiement/class/paiement.class.php
+++ b/htdocs/compta/paiement/class/paiement.class.php
@@ -1114,5 +1114,31 @@ class Paiement extends CommonObject
}*/
return '';
}
+
+ /**
+ * Load the third party of object, from id into this->thirdparty
+ *
+ * @param int $force_thirdparty_id Force thirdparty id
+ * @return int <0 if KO, >0 if OK
+ */
+ function fetch_thirdparty($force_thirdparty_id=0)
+ {
+ require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
+
+ if (empty($force_thirdparty_id))
+ {
+ $billsarray = $this->getBillsArray(); // From payment, the fk_soc isn't available, we should load the first invoice to get him
+ if (!empty($billsarray))
+ {
+ $supplier_invoice = new FactureFournisseur($this->db);
+ if ($supplier_invoice->fetch($billsarray[0]) > 0)
+ {
+ $force_thirdparty_id = $supplier_invoice->fk_soc;
+ }
+ }
+ }
+
+ return parent::fetch_thirdparty($force_thirdparty_id);
+ }
}
diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php
index da8ef616a4f..eb66ae21a4f 100644
--- a/htdocs/contact/document.php
+++ b/htdocs/contact/document.php
@@ -58,9 +58,7 @@ $result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'ro
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
-if ($page == -1) {
- $page = 0;
-}
+if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
@@ -108,7 +106,7 @@ if ($object->id)
}
$linkback = ''.$langs->trans("BackToList").'';
-
+
$morehtmlref='
| '.$langs->trans("UserTitle").' | ';
print $object->getCivilityLabel();
@@ -160,7 +158,7 @@ if ($object->id)
print '';
dol_fiche_end();
-
+
$modulepart = 'contact';
$permission = $user->rights->societe->contact->creer;
$permtoedit = $user->rights->societe->contact->creer;
diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php
index b01637d7b08..dd756830f41 100644
--- a/htdocs/core/lib/product.lib.php
+++ b/htdocs/core/lib/product.lib.php
@@ -477,3 +477,42 @@ function measuring_units_string($unit,$measuring_style='')
return $measuring_units[$unit];
}
+
+/**
+ * Transform a given unit into the square of that unit, if known
+ *
+ * @param int $unit Unit key (-3,-2,-1,0,98,99...)
+ * @return int Squared unit key (-6,-4,-2,0,98,99...)
+ * @see formproduct->load_measuring_units
+ */
+function measuring_units_squared($unit)
+{
+ $measuring_units=array();
+ $measuring_units[0] = 0; // m -> m3
+ $measuring_units[-1] = -2; // dm-> dm2
+ $measuring_units[-2] = -4; // cm -> cm2
+ $measuring_units[-3] = -6; // mm -> mm2
+ $measuring_units[98] = 98; // foot -> foot2
+ $measuring_units[99] = 99; // inch -> inch2
+ return $measuring_units[$unit];
+}
+
+
+/**
+ * Transform a given unit into the cube of that unit, if known
+ *
+ * @param int $unit Unit key (-3,-2,-1,0,98,99...)
+ * @return int Cubed unit key (-9,-6,-3,0,88,89...)
+ * @see formproduct->load_measuring_units
+ */
+function measuring_units_cubed($unit)
+{
+ $measuring_units=array();
+ $measuring_units[0] = 0; // m -> m2
+ $measuring_units[-1] = -3; // dm-> dm3
+ $measuring_units[-2] = -6; // cm -> cm3
+ $measuring_units[-3] = -9; // mm -> mm3
+ $measuring_units[98] = 88; // foot -> foot3
+ $measuring_units[99] = 89; // inch -> inch3
+ return $measuring_units[$unit];
+}
diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php
index f9dac51389f..72ea8925177 100644
--- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php
+++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php
@@ -1,6 +1,7 @@
* Copyright (C) 2012 Juanjo Menent | ||