diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 97ecce50a15..c578e5d9786 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -174,7 +174,7 @@ class FormFile
$out .= '
';
$out .= '';
$out .= $langs->trans("Link") . ': ';
- $out .= '';
+ $out .= '';
$out .= ' ' . $langs->trans("Label") . ': ';
$out .= '';
$out .= '';
@@ -1063,6 +1063,9 @@ class FormFile
// Show list of associated links
print_titre($langs->trans("LinkedFiles"));
+
+ print '';
+
return $nboflinks;
}
diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php
index 4727044ba45..22b90ef52e0 100644
--- a/htdocs/core/lib/functions2.lib.php
+++ b/htdocs/core/lib/functions2.lib.php
@@ -442,7 +442,7 @@ function isValidUrl($url,$http=0,$pass=0,$port=0,$path=0,$query=0,$anchor=0)
* Clean an url string
*
* @param string $url Url
- * @param string $http 1: keep http://, 0: remove also http://
+ * @param string $http 1 = keep both http:// and https://, 0: remove http:// but not https://
* @return string Cleaned url
*/
function clean_url($url,$http=1)
diff --git a/htdocs/core/tpl/document_actions_post_headers.tpl.php b/htdocs/core/tpl/document_actions_post_headers.tpl.php
index 201355e60fe..5e06b585b57 100644
--- a/htdocs/core/tpl/document_actions_post_headers.tpl.php
+++ b/htdocs/core/tpl/document_actions_post_headers.tpl.php
@@ -20,22 +20,24 @@
/*
* Confirm suppression
*/
-if ($action == 'delete') {
- $ret = $form->form_confirm(
- $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode(GETPOST("urlfile")) . '&linkid=' . GETPOST('linkid', 'int'),
- $langs->trans('DeleteFile'),
- $langs->trans('ConfirmDeleteFile'),
- 'confirm_deletefile',
- '',
- 0,
- 1
- );
- if ($ret == 'html') print ' ';
+
+if ($action == 'delete')
+{
+ $ret = $form->form_confirm(
+ $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode(GETPOST("urlfile")) . '&linkid=' . GETPOST('linkid', 'int'),
+ $langs->trans('DeleteFile'),
+ $langs->trans('ConfirmDeleteFile'),
+ 'confirm_deletefile',
+ '',
+ 0,
+ 1
+ );
+ if ($ret == 'html') print ' ';
}
$formfile=new FormFile($db);
-// Show upload form
+// Show upload form (document and links)
$formfile->form_attach_new_file(
$_SERVER["PHP_SELF"].'?id='.$object->id,
'',
diff --git a/htdocs/core/tpl/document_actions_pre_headers.tpl.php b/htdocs/core/tpl/document_actions_pre_headers.tpl.php
index 18b7c18c4a5..96344944666 100644
--- a/htdocs/core/tpl/document_actions_pre_headers.tpl.php
+++ b/htdocs/core/tpl/document_actions_pre_headers.tpl.php
@@ -25,7 +25,8 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) {
} elseif (GETPOST('linkit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) {
if ($object->id) {
$link = GETPOST('link', 'alpha');
- if ($link) {
+ if ($link)
+ {
if (substr($link, 0, 7) != 'http://' && substr($link, 0, 8) != 'https://') {
$link = 'http://' . $link;
}
@@ -36,11 +37,14 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) {
// Delete file/link
-if ($action == 'confirm_deletefile' && $confirm == 'yes') {
- if ($object->id) {
+if ($action == 'confirm_deletefile' && $confirm == 'yes')
+{
+ if ($object->id)
+ {
$urlfile = GETPOST('urlfile', 'alpha');
$linkid = GETPOST('linkid', 'int');
- if ($urlfile) {
+ if ($urlfile)
+ {
$file = $upload_dir . "/" . $urlfile; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$ret = dol_delete_file($file, 0, 0, 0, $object);
@@ -49,7 +53,9 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') {
} else {
setEventMessage($langs->trans("ErrorFailToDeleteFile", $urlfile), 'errors');
}
- } elseif ($linkid) {
+ }
+ elseif ($linkid)
+ {
require_once DOL_DOCUMENT_ROOT . '/link/class/link.class.php';
$link = new Link($db);
$link->id = $linkid;
@@ -65,23 +71,30 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') {
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
exit;
}
-} elseif ($action == 'confirm_updateline' && GETPOST('save') && GETPOST('link', 'alpha')) {
+}
+elseif ($action == 'confirm_updateline' && GETPOST('save') && GETPOST('link', 'alpha'))
+{
require_once DOL_DOCUMENT_ROOT . '/link/class/link.class.php';
$langs->load('link');
$link = new Link($db);
$link->id = GETPOST('linkid', 'int');
$f = $link->fetch();
- if ($f) {
+ if ($f)
+ {
$link->url = GETPOST('link', 'alpha');
- if (substr($link->url, 0, 7) != 'http://' && substr($link->url, 0, 8) != 'https://') {
+ if (substr($link->url, 0, 7) != 'http://' && substr($link->url, 0, 8) != 'https://')
+ {
$link->url = 'http://' . $link->url;
}
$link->label = GETPOST('label', 'alpha');
$res = $link->update($user);
- if (!$res) {
+ if (!$res)
+ {
setEventMessage($langs->trans("ErrorFailedToUpdateLink", $link->label));
}
- } else {
+ }
+ else
+ {
//error fetching
}
}
diff --git a/htdocs/langs/en_US/suppliers.lang b/htdocs/langs/en_US/suppliers.lang
index 83a8e067d84..3561fd3e57e 100644
--- a/htdocs/langs/en_US/suppliers.lang
+++ b/htdocs/langs/en_US/suppliers.lang
@@ -12,6 +12,8 @@ OrderDate=Order date
BuyingPrice=Buying price
BuyingPriceMin=Minimum buying price
BuyingPriceMinShort=Min buying price
+TotalBuyingPriceMin=Total of subproducts buying prices
+SomeSubProductHaveNoPrices=Some sub-products have no price defined
AddSupplierPrice=Add supplier price
ChangeSupplierPrice=Change supplier price
ErrorQtyTooLowForThisSupplier=Quantity too low for this supplier or no price defined on this product for this supplier
diff --git a/htdocs/langs/fr_FR/suppliers.lang b/htdocs/langs/fr_FR/suppliers.lang
index 4e0514987f2..8e0f3475db4 100644
--- a/htdocs/langs/fr_FR/suppliers.lang
+++ b/htdocs/langs/fr_FR/suppliers.lang
@@ -12,6 +12,8 @@ OrderDate=Date de commande
BuyingPrice=Prix d'achat
BuyingPriceMin=Prix d'achat minimum
BuyingPriceMinShort=Prix achat min.
+TotalBuyingPriceMin=Total des prix d'achats des sous-produits
+SomeSubProductHaveNoPrices=Certains sous-produits n'ont pas de prix définis
AddSupplierPrice=Ajouter prix fournisseur
ChangeSupplierPrice=Modifier prix fournisseur
ErrorQtyTooLowForThisSupplier=Quantité trop basse pour ce fournisseur ou prix de ce produit non défini pour ce fournisseur
diff --git a/htdocs/link/class/link.class.php b/htdocs/link/class/link.class.php
index fb924eeec9d..0bb57c52cf6 100644
--- a/htdocs/link/class/link.class.php
+++ b/htdocs/link/class/link.class.php
@@ -154,22 +154,22 @@ class Link extends CommonObject
{
global $langs,$conf;
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+
$langs->load("errors");
$error=0;
dol_syslog(get_class($this)."::Update id = " . $this->id . " call_trigger = " . $call_trigger);
// Check parameters
- if (empty($this->url)) {
+ if (empty($this->url))
+ {
$this->error = $langs->trans("NoURL");
return -1;
}
// Clean parameters
- $this->url = clean_url($this->url,0);
- if(empty($this->label)) {
- $this->label = basename($this->url);
- }
+ $this->url = clean_url($this->url,1);
+ if (empty($this->label)) $this->label = basename($this->url);
$this->label = trim($this->label);
@@ -189,7 +189,8 @@ class Link extends CommonObject
$resql = $this->db->query($sql);
if ($resql)
{
- if ($call_trigger) {
+ if ($call_trigger)
+ {
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface = new Interfaces($this->db);
@@ -201,7 +202,8 @@ class Link extends CommonObject
// Fin appel triggers
}
- if (! $error) {
+ if (! $error)
+ {
dol_syslog(get_class($this) . "::Update success");
$this->db->commit();
return 1;
@@ -209,14 +211,19 @@ class Link extends CommonObject
$this->db->rollback();
return -1;
}
- } else {
- if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
+ }
+ else
+ {
+ if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
+ {
// Doublon
$this->error = $langs->trans("ErrorDuplicateField");
$result = -1;
- } else {
+ }
+ else
+ {
$this->error = $langs->trans("Error sql = " . $sql);
- dol_syslog(get_class($this) . "::Update fails update sql = " . $sql, LOG_ERR);
+ dol_syslog(get_class($this) . "::Update fails update = " . $this->error, LOG_ERR);
$result = -2;
}
$this->db->rollback();
diff --git a/htdocs/product/composition/fiche.php b/htdocs/product/composition/fiche.php
index 574aa1024e3..fac6402e300 100644
--- a/htdocs/product/composition/fiche.php
+++ b/htdocs/product/composition/fiche.php
@@ -71,7 +71,7 @@ $cancel <> $langs->trans("Cancel") &&
($user->rights->produit->creer || $user->rights->service->creer))
{
$error=0;
- for($i=0;$i<$_POST["max_prod"];$i++)
+ for ($i=0; $i<$_POST["max_prod"]; $i++)
{
if ($_POST["prod_id_chk".$i] > 0)
{
@@ -328,6 +328,7 @@ if ($id > 0 || ! empty($ref))
// List of subproducts
if (count($prods_arbo) > 0)
{
+ $atleastonenotdefined=0;
print ' |
';
print $langs->trans("ProductAssociationList").' ';
print '';
@@ -343,13 +344,13 @@ if ($id > 0 || ! empty($ref))
{
$notdefined=0;
$productstatic->ref=$value['fullpath'];
- print '| '.$productstatic->getNomUrl(1,'composition').' ('.$value['nb'].') | ';
+ print ''.$productstatic->getNomUrl(1,'composition').' ('.$value['nb'].') | ';
print '';
if ($product_fourn->find_min_price_product_fournisseur($productstatic->id, $value['nb']) > 0)
{
print $langs->trans("BuyingPriceMinShort").': ';
if ($product_fourn->product_fourn_price_id > 0) print $product_fourn->display_price_product_fournisseur(0,0);
- else { print $langs->trans("NotDefined"); $notdefined=1; }
+ else { print $langs->trans("NotDefined"); $notdefined++; $atleastonenotdefined++; }
}
print ' | ';
$totalline=price2num($value['nb'] * $product_fourn->fourn_unitprice, 'MT');
@@ -364,7 +365,7 @@ if ($id > 0 || ! empty($ref))
{
print ' ';
}
- print $productstatic->getNomUrl(1,'composition').' ('.$value['nb'].') ';
+ print $productstatic->getNomUrl(1,'composition').' ('.$value['nb'].')';
print ' | ';
print ' | | ';
if (! empty($conf->stock->enabled)) print ' | | '; // Real stock
@@ -372,8 +373,10 @@ if ($id > 0 || ! empty($ref))
print '';
}
print '';
- print '| '.$langs->trans("BuyingPriceMin").': '.price($total,'','',0,0,-1,$conf->currency).' | ';
- print ' | ';
+ print ''.$langs->trans("TotalBuyingPriceMin").': ';
+ if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')';
+ print ' | ';
+ print ''.($atleastonenotdefined?'':price($total,'','',0,0,-1,$conf->currency)).' | ';
if (! empty($conf->stock->enabled)) print ' | ';
print ' ';
print ' ';
|