diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl
index 5ec53b0a080..690c5f8d238 100755
--- a/build/makepack-dolibarr.pl
+++ b/build/makepack-dolibarr.pl
@@ -19,7 +19,7 @@ use Term::ANSIColor;
# Change this to defined target for option 98 and 99
$PROJECT="dolibarr";
$PUBLISHSTABLE="eldy,dolibarr\@frs.sourceforge.net:/home/frs/project/dolibarr";
-$PUBLISHBETARC="ldestailleur\@vmprod.dolibarr.org:/home/dolibarr/dolibarr.org/httpdocs/files";
+$PUBLISHBETARC="dolibarr\@vmprod1.dolibarr.org:/home/dolibarr/dolibarr.org/httpdocs/files";
#@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","APS","EXEDOLIWAMP","SNAPSHOT"); # Possible packages
diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index e0f6b796826..e0a4c19c9cb 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -494,7 +494,7 @@ if (empty($reshook))
$tva_tx = $lines[$i]->tva_tx;
if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')';
-
+
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $date_start, $date_end, $array_options, $lines[$i]->fk_unit);
if ($result > 0) {
@@ -735,7 +735,7 @@ if (empty($reshook))
$db->begin();
// $tva_tx can be 'x.x (XXX)'
-
+
// Ecrase $pu par celui du produit
// Ecrase $desc par celui du produit
// Ecrase $tva_tx par celui du produit
@@ -750,7 +750,7 @@ if (empty($reshook))
$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id);
$tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id);
if (empty($tva_tx)) $tva_npr=0;
-
+
$pu_ht = $prod->price;
$pu_ttc = $prod->price_ttc;
$price_min = $prod->price_min;
@@ -791,7 +791,7 @@ if (empty($reshook))
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
-
+
// if price ht is forced (ie: calculated by margin rate and cost price). TODO Why this ?
if (! empty($price_ht)) {
$pu_ht = price2num($price_ht, 'MU');
@@ -844,13 +844,33 @@ if (empty($reshook))
// Add custom code and origin country into description
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code)))
{
- $tmptxt = '(';
- if (! empty($prod->customcode))
- $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
- if (! empty($prod->customcode) && ! empty($prod->country_code))
- $tmptxt .= ' - ';
- if (! empty($prod->country_code))
- $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0);
+ // Define output language
+ if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
+ $outputlangs = $langs;
+ $newlang = '';
+ if (empty($newlang) && GETPOST('lang_id','alpha'))
+ $newlang = GETPOST('lang_id','alpha');
+ if (empty($newlang))
+ $newlang = $object->thirdparty->default_lang;
+ if (! empty($newlang)) {
+ $outputlangs = new Translate("", $conf);
+ $outputlangs->setDefaultLang($newlang);
+ $outputlangs->load('products');
+ }
+ if (! empty($prod->customcode))
+ $tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
+ if (! empty($prod->customcode) && ! empty($prod->country_code))
+ $tmptxt .= ' - ';
+ if (! empty($prod->country_code))
+ $tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $outputlangs, 0);
+ } else {
+ if (! empty($prod->customcode))
+ $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
+ if (! empty($prod->customcode) && ! empty($prod->country_code))
+ $tmptxt .= ' - ';
+ if (! empty($prod->country_code))
+ $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0);
+ }
$tmptxt .= ')';
$desc = dol_concatdesc($desc, $tmptxt);
}
@@ -969,7 +989,7 @@ if (empty($reshook))
// Add buying price
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
-
+
$pu_ht_devise = GETPOST('multicurrency_subprice');
$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
@@ -1305,7 +1325,7 @@ if ($action == 'create')
// Replicate extrafields
$objectsrc->fetch_optionals($originid);
$object->array_options = $objectsrc->array_options;
-
+
if (!empty($conf->multicurrency->enabled))
{
if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code;
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 67978ff99e8..d84495da26a 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -49,7 +49,7 @@ if (! empty($conf->projet->enabled)) {
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
}
-
+
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$langs->load('orders');
@@ -112,7 +112,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook))
{
- if ($cancel)
+ if ($cancel)
{
if ($action != 'addlink' && $action != 'updateline')
{
@@ -126,7 +126,7 @@ if (empty($reshook))
}
$action='';
}
-
+
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
@@ -375,7 +375,7 @@ if (empty($reshook))
$tva_tx = $lines[$i]->tva_tx;
if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')';
-
+
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $date_start, $date_end, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->fk_unit, $object->origin, $lines[$i]->rowid);
if ($result < 0) {
@@ -760,7 +760,7 @@ if (empty($reshook))
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
-
+
// if price ht is forced (ie: calculated by margin rate and cost price). TODO Why this ?
if (! empty($price_ht)) {
$pu_ht = price2num($price_ht, 'MU');
@@ -782,8 +782,8 @@ if (empty($reshook))
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
$outputlangs = $langs;
$newlang = '';
- if (empty($newlang) && GETPOST('lang_id'))
- $newlang = GETPOST('lang_id');
+ if (empty($newlang) && GETPOST('lang_id','alpha'))
+ $newlang = GETPOST('lang_id','alpha');
if (empty($newlang))
$newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) {
@@ -801,12 +801,33 @@ if (empty($reshook))
// Add custom code and origin country into description
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) {
$tmptxt = '(';
- if (! empty($prod->customcode))
- $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
- if (! empty($prod->customcode) && ! empty($prod->country_code))
- $tmptxt .= ' - ';
- if (! empty($prod->country_code))
- $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0);
+ // Define output language
+ if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
+ $outputlangs = $langs;
+ $newlang = '';
+ if (empty($newlang) && GETPOST('lang_id','alpha'))
+ $newlang = GETPOST('lang_id','alpha');
+ if (empty($newlang))
+ $newlang = $object->thirdparty->default_lang;
+ if (! empty($newlang)) {
+ $outputlangs = new Translate("", $conf);
+ $outputlangs->setDefaultLang($newlang);
+ $outputlangs->load('products');
+ }
+ if (! empty($prod->customcode))
+ $tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
+ if (! empty($prod->customcode) && ! empty($prod->country_code))
+ $tmptxt .= ' - ';
+ if (! empty($prod->country_code))
+ $tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $outputlangs, 0);
+ } else {
+ if (! empty($prod->customcode))
+ $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
+ if (! empty($prod->customcode) && ! empty($prod->country_code))
+ $tmptxt .= ' - ';
+ if (! empty($prod->country_code))
+ $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0);
+ }
$tmptxt .= ')';
$desc = dol_concatdesc($desc, $tmptxt);
}
@@ -2285,7 +2306,7 @@ if ($action == 'create' && $user->rights->commande->creer)
}
print '';
*/
-
+
$tmparray=$object->getTotalWeightVolume();
$totalWeight=$tmparray['weight'];
$totalVolume=$tmparray['volume'];
@@ -2365,18 +2386,18 @@ if ($action == 'create' && $user->rights->commande->creer)
print '
| ' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . ' | ';
print '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' | ';
print '
';
-
+
// Multicurrency Amount VAT
print '| ' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . ' | ';
print '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' | ';
print '
';
-
+
// Multicurrency Amount TTC
print '| ' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . ' | ';
print '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' | ';
print '
';
}
-
+
// Total HT
print '| ' . $langs->trans('AmountHT') . ' | ';
print '' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . ' | ';
@@ -2471,7 +2492,7 @@ if ($action == 'create' && $user->rights->commande->creer)
}
print '';
print '';
-
+
print "\n";
dol_fiche_end();
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index ad5f69edfc0..39d603a6c5e 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -611,7 +611,7 @@ if (empty($reshook))
$i = 0;
foreach ($object->lines as $line)
{
- if ($line->total_ht!=0)
+ if ($line->product_type < 9 && $line->total_ht != 0) // Remove lines with product_type greater than or equal to 9
{ // no need to create discount if amount is null
$amount_ht[$line->tva_tx] += $line->total_ht;
$amount_tva[$line->tva_tx] += $line->total_tva;
@@ -1504,12 +1504,33 @@ if (empty($reshook))
// Add custom code and origin country into description
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) {
$tmptxt = '(';
- if (! empty($prod->customcode))
- $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
- if (! empty($prod->customcode) && ! empty($prod->country_code))
- $tmptxt .= ' - ';
- if (! empty($prod->country_code))
- $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0);
+ // Define output language
+ if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
+ $outputlangs = $langs;
+ $newlang = '';
+ if (empty($newlang) && GETPOST('lang_id','alpha'))
+ $newlang = GETPOST('lang_id','alpha');
+ if (empty($newlang))
+ $newlang = $object->thirdparty->default_lang;
+ if (! empty($newlang)) {
+ $outputlangs = new Translate("", $conf);
+ $outputlangs->setDefaultLang($newlang);
+ $outputlangs->load('products');
+ }
+ if (! empty($prod->customcode))
+ $tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
+ if (! empty($prod->customcode) && ! empty($prod->country_code))
+ $tmptxt .= ' - ';
+ if (! empty($prod->country_code))
+ $tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $outputlangs, 0);
+ } else {
+ if (! empty($prod->customcode))
+ $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
+ if (! empty($prod->customcode) && ! empty($prod->country_code))
+ $tmptxt .= ' - ';
+ if (! empty($prod->country_code))
+ $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0);
+ }
$tmptxt .= ')';
$desc = dol_concatdesc($desc, $tmptxt);
}
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 60970b5b1e2..d1ede7cb41d 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -2878,7 +2878,7 @@ class Facture extends CommonInvoice
// Cap percentages to 100
if ($percent > 100) $percent = 100;
$line->situation_percent = $percent;
- $tabprice = calcul_price_total($line->qty, $line->subprice, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->product_type, 'HT', 0, 0, $mysoc, '', $percent);
+ $tabprice = calcul_price_total($line->qty, $line->subprice, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 0, 'HT', 0, $line->product_type, $mysoc, '', $percent);
$line->total_ht = $tabprice[0];
$line->total_tva = $tabprice[1];
$line->total_ttc = $tabprice[2];
diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php
index d6424309f87..c768744505c 100644
--- a/htdocs/compta/facture/document.php
+++ b/htdocs/compta/facture/document.php
@@ -4,6 +4,7 @@
* Copyright (C) 2005 Marc Barilley / Ocebo
* Copyright (C) 2005-2011 Regis Houssin
* Copyright (C) 2013 Cédric Salvador
+ * Copyright (C) 2017 Frédéric France
*
* 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
@@ -188,6 +189,6 @@ else
print $langs->trans("ErrorUnknown");
}
-$db->close();
-
llxFooter();
+
+$db->close();
diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php
index 4d9fdebeb64..6670ed763e1 100644
--- a/htdocs/compta/facture/stats/index.php
+++ b/htdocs/compta/facture/stats/index.php
@@ -84,7 +84,7 @@ dol_mkdir($dir);
$stats = new FactureStats($db, $socid, $mode, ($userid>0?$userid:0));
if ($mode == 'customer')
{
- if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND f.fk_statut IN ('.$object_status.')';
+ if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND f.fk_statut IN ('.$object_status.')';
}
if ($mode == 'supplier')
{
diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php
index e81d0e38345..2b6f47037f0 100644
--- a/htdocs/compta/paiement.php
+++ b/htdocs/compta/paiement.php
@@ -745,7 +745,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
{
// Print total
print '';
- print '| '.$langs->trans('TotalTTC').' | ';
+ print ''.$langs->trans('TotalTTC').' | ';
+ if (!empty($conf->multicurrency->enabled)) print ' | ';
if (!empty($conf->multicurrency->enabled)) print ' | ';
if (!empty($conf->multicurrency->enabled)) print ' | ';
if (!empty($conf->multicurrency->enabled)) print ' | ';
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 375c98c3c0b..86a57b1c144 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -322,7 +322,11 @@ class Contrat extends CommonObject
$result=$this->thirdparty->set_as_client();
// Define new ref
- if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life
+ if ($force_number)
+ {
+ $num = $force_number;
+ }
+ else if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life
{
$num = $this->getNextNumRef($this->thirdparty);
}
diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php
index f21c476fe35..09df597d017 100644
--- a/htdocs/contrat/services.php
+++ b/htdocs/contrat/services.php
@@ -75,7 +75,7 @@ $opclotureyear=GETPOST('opclotureyear');
$filter_opcloture=GETPOST('filter_opcloture');
// Initialize context for list
-$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'servicelist'.$mode;
+$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'contractservicelist'.$mode;
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array($contextpage));
diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php
index 203d41571a9..da55a9f5668 100644
--- a/htdocs/core/class/conf.class.php
+++ b/htdocs/core/class/conf.class.php
@@ -88,6 +88,7 @@ class Conf
$this->user = new stdClass();
$this->syslog = new stdClass();
$this->browser = new stdClass();
+ $this->medias = new stdClass();
$this->multicompany = new stdClass();
//! Charset for HTML output and for storing data in memory
@@ -328,6 +329,10 @@ class Conf
$this->propal->dir_output=$rootfordata."/propale";
$this->propal->dir_temp=$rootfordata."/propale/temp";
+ // For medias storage
+ $this->medias->multidir_output = array($this->entity => $rootfordata."/medias");
+ $this->medias->multidir_temp = array($this->entity => $rootfordata."/medias/temp");
+
// Exception: Some dir are not the name of module. So we keep exception here
// for backward compatibility.
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index 96d43ee4e5f..3839c867df4 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -1275,10 +1275,10 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
else $out.='-'.dol_print_date($histo[$key]['dateend'],'dayhour');
}
$late=0;
- if ($histo[$key]['percent'] == 0 && $histo[$key]['datestart'] && $db->jdate($histo[$key]['datestart']) < ($now - $delay_warning)) $late=1;
- if ($histo[$key]['percent'] == 0 && ! $histo[$key]['datestart'] && $histo[$key]['dateend'] && $db->jdate($histo[$key]['datestart']) < ($now - $delay_warning)) $late=1;
- if ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100 && $histo[$key]['dateend'] && $db->jdate($histo[$key]['dateend']) < ($now - $delay_warning)) $late=1;
- if ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100 && ! $histo[$key]['dateend'] && $histo[$key]['datestart'] && $db->jdate($histo[$key]['datestart']) < ($now - $delay_warning)) $late=1;
+ if ($histo[$key]['percent'] == 0 && $histo[$key]['datestart'] && $histo[$key]['datestart'] < ($now - $delay_warning)) $late=1;
+ if ($histo[$key]['percent'] == 0 && ! $histo[$key]['datestart'] && $histo[$key]['dateend'] && $histo[$key]['datestart'] < ($now - $delay_warning)) $late=1;
+ if ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100 && $histo[$key]['dateend'] && $histo[$key]['dateend'] < ($now - $delay_warning)) $late=1;
+ if ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100 && ! $histo[$key]['dateend'] && $histo[$key]['datestart'] && $histo[$key]['datestart'] < ($now - $delay_warning)) $late=1;
if ($late) $out.=img_warning($langs->trans("Late")).' ';
$out.="\n";
diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php
index 5d3c209bdc7..b573a9588ae 100644
--- a/htdocs/core/lib/files.lib.php
+++ b/htdocs/core/lib/files.lib.php
@@ -1857,7 +1857,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
elseif ($modulepart == 'medias' && !empty($dolibarr_main_data_root))
{
$accessallowed=1;
- $original_file=$dolibarr_main_data_root.'/medias/'.$original_file;
+ $original_file=$conf->medias->multidir_output[$entity].'/'.$original_file;
}
// Wrapping for backups
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index 05bbc26e5fc..c241b2a2ffa 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -390,7 +390,7 @@ if (empty($reshook))
$localtax1_tx,
$localtax2_tx,
$idprod,
- $productsupplier->id,
+ $productsupplier->product_fourn_price_id,
$productsupplier->fourn_ref,
$remise_percent,
'HT',
diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php
index 8e8ab6f287c..0a4d0cb37ca 100644
--- a/htdocs/holiday/card.php
+++ b/htdocs/holiday/card.php
@@ -149,7 +149,7 @@ if ($action == 'create')
if (! $error)
{
- $object->fk_user = $userid;
+ $object->fk_user = $fuserid;
$object->description = $description;
$object->date_debut = $date_debut;
$object->date_fin = $date_fin;
diff --git a/htdocs/index.php b/htdocs/index.php
index e6fb102fb80..3ff6274f8be 100644
--- a/htdocs/index.php
+++ b/htdocs/index.php
@@ -385,7 +385,7 @@ if ($showweather) $boxwork.=''."\n";
// Do not include sections without management permission
-require DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php';
// Number of actions to do (late)
if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->read)
diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php
index 2757234251d..69355a7f1e8 100644
--- a/htdocs/product/admin/product.php
+++ b/htdocs/product/admin/product.php
@@ -56,7 +56,6 @@ $select_pricing_rules=array(
);
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
- $langs->load("admin");
$select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY'] = $langs->trans('PriceByQuantity').' ('.$langs->trans("VersionExperimental").')'; // TODO If this is enabled, price must be hidden when price by qty is enabled, also price for quantity must be used when adding product into order/propal/invoice
$select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY&PRODUIT_MULTIPRICES'] = $langs->trans('MultiPricesAbility') . '+' . $langs->trans('PriceByQuantity').' ('.$langs->trans("VersionExperimental").')';
}
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 2e2f3007540..07aaf32cbb3 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -1384,6 +1384,7 @@ class Product extends CommonObject
$this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product of supplier
$this->fourn_price_base_type = 'HT'; // Price base type
$this->ref_fourn = $obj->ref_fourn; // deprecated
+ $this->product_fourn_price_id = $obj->rowid; // supplier price id
$this->ref_supplier = $obj->ref_fourn; // Ref supplier
$this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier
$result=$obj->fk_product;
@@ -1428,6 +1429,7 @@ class Product extends CommonObject
$this->fourn_qty = $obj->quantity; // min quantity for price for a virtual supplier
$this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product for a virtual supplier
$this->fourn_price_base_type = 'HT'; // Price base type for a virtual supplier
+ $this->product_fourn_price_id = $obj->rowid; // supplier price id
$this->ref_fourn = $obj->ref_supplier; // deprecated
$this->ref_supplier = $obj->ref_supplier; // Ref supplier
$this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier
diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php
index 5b1fda0371f..59a1a28ccf5 100644
--- a/htdocs/product/stock/replenishorders.php
+++ b/htdocs/product/stock/replenishorders.php
@@ -29,7 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
-require_once './lib/replenishment.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/product/stock/lib/replenishment.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$langs->load("products");
$langs->load("stocks");
@@ -44,9 +45,12 @@ $sref = GETPOST('search_ref', 'alpha');
$snom = GETPOST('search_nom', 'alpha');
$suser = GETPOST('search_user', 'alpha');
$sttc = GETPOST('search_ttc', 'alpha');
-$sdate = GETPOST('search_date', 'alpha');
$page = GETPOST('page', 'int');
$sproduct = GETPOST('sproduct', 'int');
+$search_dateyear = GETPOST('search_dateyear', 'int');
+$search_datemonth = GETPOST('search_datemonth', 'int');
+$search_dateday = GETPOST('search_dateday', 'int');
+$search_date = dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear);
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield");
@@ -58,7 +62,6 @@ if ($page < 0) $page = 0;
$offset = $limit * $page;
-
/*
* Actions
*/
@@ -70,7 +73,10 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
$snom="";
$suser="";
$sttc="";
- $sdate='';
+ $search_date='';
+ $search_datemonth='';
+ $search_dateday='';
+ $search_dateyear='';
$sproduct=0;
}
@@ -125,17 +131,19 @@ if ($sref) $sql .= natural_search('cf.ref', $sref);
if ($snom) $sql .= natural_search('s.nom', $snom);
if ($suser) $sql .= natural_search('u.login', $suser);
if ($sttc) $sql .= natural_search('cf.total_ttc', $sttc, 1);
-if ($sdate)
+
+if ($search_datemonth > 0)
{
- if (GETPOST('search_datemonth', 'int') && GETPOST('search_dateday', 'int') && GETPOST('search_dateyear', 'int'))
- {
- $date = dol_mktime(0, 0, 0, GETPOST('search_datemonth', 'int'), GETPOST('search_dateday', 'int'), GETPOST('search_dateyear', 'int'));
- }
- else
- {
- $date = dol_stringtotime($sdate);
- }
- $sql .= " AND cf.date_creation = '" . $db->idate($date) . "'";
+ if ($search_dateyear > 0 && empty($search_dateday))
+ $sql.= " AND cf.date_creation BETWEEN '".$db->idate(dol_get_first_day($search_dateyear,$search_datemonth,false))."' AND '".$db->idate(dol_get_last_day($search_dateyear,$search_datemonth,false))."'";
+ else if ($search_dateyear > 0 && ! empty($search_dateday))
+ $sql.= " AND cf.date_creation BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_datemonth, $search_dateday, $search_dateyear))."'";
+ else
+ $sql.= " AND date_format(cf.date_creation, '%m') = '".$search_datemonth."'";
+}
+else if ($search_dateyear > 0)
+{
+ $sql.= " AND cf.date_creation BETWEEN '".$db->idate(dol_get_first_day($search_dateyear,1,false))."' AND '".$db->idate(dol_get_last_day($search_dateyear,12,false))."'";
}
if ($sall) $sql .= natural_search(array('cf.ref','cf.note'), $sall);
if (!empty($socid)) $sql .= ' AND s.rowid = ' . $socid;
@@ -146,7 +154,6 @@ $sql .= ' GROUP BY cf.rowid, cf.ref, cf.date_creation, cf.fk_statut';
$sql .= ', cf.total_ttc, cf.fk_user_author, u.login, s.rowid, s.nom';
$sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($limit+1, $offset);
-//print $sql;
$resql = $db->query($sql);
if ($resql)
@@ -158,6 +165,19 @@ if ($resql)
print_barre_liste('', $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', $num, 0, '');
+ $param='';
+ if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
+ if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
+ if ($sref) $param.='&search_ref='.urlencode($sref);
+ if ($snom) $param.='&search_nom='.urlencode($snom);
+ if ($suser) $param.='&search_user='.urlencode($suser);
+ if ($sttc) $param.='&search_ttc='.urlencode($sttc);
+ if ($search_dateyear) $param.='&search_dateyear='.urlencode($search_dateyear);
+ if ($search_datemonth) $param.='&search_datemonth='.urlencode($search_datemonth);
+ if ($search_dateday) $param.='&search_dateday='.urlencode($search_dateday);
+ if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
+
+
print ' |