Merge remote-tracking branch 'upstream/3.9' into 3.9

This commit is contained in:
Juanjo Menent 2016-08-03 10:11:37 +02:00
commit aadf52fe59
16 changed files with 103 additions and 28 deletions

View File

@ -11,7 +11,6 @@ during migration.
Upgrading to any other version or any other database system is abolutely required BEFORE trying
make a Dolibarr upgrade.
***** ChangeLog for 3.9.3 compared to 3.9.2 *****
FIX: #4383 $userid not defined
FIX: #4448 $filebonprev is not used, $this->filename now
@ -311,7 +310,68 @@ This is list of hooks modified:
- Remove deprecated Product::hidden property
***** ChangeLog for 3.8.5 compared to 3.8.4 *****
FIX: #3815 Call to undefined function local_by_date().
FIX: #4424 Missing email of user popup in supplier orders area
FIX: #4442 Missing translation in Banks menu
FIX: #4448 $filebonprev is not used, $this->filename now
FIX: #4455
FIX: #4737 Bank transacion type selector translation is cropped
FIX: #4742 Able to delete a supplier invoice with a registered payment
FIX: #4743 UI glitch in project summary page
FIX: #4747 Missing UI background when registering a supplier invoice payment
FIX: #4748 Supplier invoice payment confirmation amount is not translated
FIX: #4749
FIX: #4756
FIX: #4766 VAT not shown in supplier invoice popup
FIX: #4809 - Duplicate functions with different content
FIX: #4851 Project selector in supplier invoices shows the project label twice
FIX: #4870
FIX: #5008 SQL error when editing the reference of a supplier invoice that already exists
FIX: #5048 Product supplier list display only one produc
FIX: #5170 tva sign with INVOICE_POSITIVE_CREDIT_NOTE option
FIX: #5203
FIX: #5207
FIX: #5338 use of not initialized var $aphour, $apmin, etc
FIX: #5380
FIX: #5383 bad object id on don delete
FIX: #5474 Country_id of "Don" object is still empty
FIX: Accountancy - 3.8 - Chart of accounts are limited on only one country
FIX: Bad include and param for project numbering module call
FIX: Box disabled because bugged
FIX: bug on email template
FIX: Can correct stock of lot using eatby or sell by date
FIX: Can make a movement on "out of sell" products
FIX: Can't create thirdparty or validate invoice if profid is mandatory and profid does not exists for other countries
FIX: can't fetch by siret or siren because of first "if"
FIX: Check stock of product by warehouse if $entrepot_id defined on shippings
FIX: correct display of minimum buying price
FIX: Creation of thumb image for size "small" was not done.
FIX: Direction of movement lost if an error occurs
FIX: dont retrieve new buying price on margin display
FIX: Duplicate records into export
FIX: Email templates not compatible with Multicompany
FIX: end of select when no fournprice
FIX: finished parameters not used
FIX: hook on group card called but not initialized
FIX: It doesn't check if there is enough stock to update the lines of orders/invoices
FIX: large expense note
FIX: missing column when module was installed before standard integration
FIX: Missing database escaping on supplier price insert/update
FIX: Not filtering correctly when come from dashboard
FIX: PROPAL_MERGE_PDF with PRODUCT_USE_OLD_PATH
FIX: real min buying price
FIX: receiving link never works
FIX: same page added several times on mergepropal option
FIX: search on date into supplier invoice list dont work because of status -1
FIX: Search supplier ref on contract
FIX: SQL error function on getAvailableDiscounts function, on bill create mode if socid is empty
FIX: systematic rounding causes prices to be updated without reason
FIX: task ODT company object not correctly retrieved
FIX: Template email must take care of positino column
FIX: VAT rate can be negative. Example spain selling to morroco.
***** ChangeLog for 3.8.4 compared to 3.8.3 *****
FIX: #3694
FIX: #3798 #2519 Cron jobs would never be executed

View File

@ -3,7 +3,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2014-2016 Ferran Marcet <fmarcet@2byte.es>
*
* 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
@ -919,7 +919,7 @@ class BonPrelevement extends CommonObject
$dir=$conf->prelevement->dir_output.'/receipts';
if (! is_dir($dir)) dol_mkdir($dir);
$this->filename = $dir.'/receipts/'.$ref.'.xml';
$this->filename = $dir.'/'.$ref.'.xml';
// Create withdraw receipt in database
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons (";

View File

@ -141,7 +141,7 @@ if ($prev_id)
print price($row[0]);
print '</td><td align="right">';
print round($row[0]/$bon->amount*100,2)." %";
if ($bon->amount) print round($row[0]/$bon->amount*100,2)." %";
print '</td>';
print "</tr>\n";

View File

@ -430,7 +430,7 @@ abstract class CommonDocGenerator
'line_fulldesc'=>doc_getlinedesc($line,$outputlangs),
'line_product_ref'=>$line->product_ref,
'line_product_label'=>$line->product_label,
'line_product_type'=>$line->product_type,
'line_product_type'=>$line->product_type,
'line_desc'=>$line->desc,
'line_vatrate'=>vatrate($line->tva_tx,true,$line->info_bits),
'line_up'=>price2num($line->subprice),
@ -444,9 +444,9 @@ abstract class CommonDocGenerator
'line_price_ttc_locale'=>price($line->total_ttc, 0, $outputlangs),
'line_price_vat_locale'=>price($line->total_tva, 0, $outputlangs),
'line_date_start'=>$line->date_start,
'line_date_start_rfc'=>dol_print_date($line->date_start,'rfc'),
'line_date_start_rfc'=>dol_print_date($line->date_start,'dayrfc'),
'line_date_end'=>$line->date_end,
'line_date_end_rfc'=>dol_print_date($line->date_end,'rfc')
'line_date_end_rfc'=>dol_print_date($line->date_end,'dayrfc')
);
// Retrieve extrafields

View File

@ -167,7 +167,8 @@ class HookManager
'printObjectLine',
'printObjectSubLine',
'createDictionaryFieldList',
'editDictionaryFieldlist'
'editDictionaryFieldlist',
'getFormMail'
)
)) $hooktype='addreplace';
// Deprecated hook types ('returnvalue')

View File

@ -1012,6 +1012,9 @@ function getParameterByName(name, valueifnotfound)
}
})();
// Another solution, easier, to build a javascript rounding function
function dolroundjs(number, decimals) { return +(Math.round(number + "e+" + decimals) + "e-" + decimals); }
/**
* Function similar to PHP price2num()
@ -1024,7 +1027,7 @@ function price2numjs(amount) {
if (amount == '') return '';
<?php
$dec = ',';
$dec = ',';
$thousand = ' ';
if ($langs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") {
$dec = $langs->transnoentitiesnoconv("SeparatorDecimal");
@ -1032,6 +1035,7 @@ function price2numjs(amount) {
if ($langs->transnoentitiesnoconv("SeparatorThousand") != "SeparatorThousand") {
$thousand = $langs->transnoentitiesnoconv("SeparatorThousand");
}
if ($thousand == 'Space') $thousand=' ';
print "var dec='" . dol_escape_js($dec) . "'; var thousand='" . dol_escape_js($thousand) . "';\n"; // Set var in javascript
?>
@ -1050,11 +1054,15 @@ function price2numjs(amount) {
if (nbdec > rounding) rounding = nbdec;
// If rounding higher than max shown
if (rounding > main_max_dec_shown) rounding = main_max_dec_shown;
if (thousand != ',' && thousand != '.') amount = amount.replace(',', '.');
amount = amount.replace(' ', ''); // To avoid spaces
amount = amount.replace(thousand, ''); // Replace of thousand before replace of dec to avoid pb if thousand is .
amount = amount.replace(dec, '.');
return Math.round10(amount, rounding);
//console.log("amount before="+amount+" rouding="+rounding)
var res = Math.round10(amount, - rounding);
// Other solution is
// var res = dolroundjs(amount, rounding)
console.log("res="+res)
return res;
}

View File

@ -100,7 +100,8 @@ class pdf_merou extends ModelePdfExpedition
$outputlangs->load("propal");
$outputlangs->load("deliveries");
$outputlangs->load("sendings");
$outputlangs->load("productbatch");
if ($conf->expedition->dir_output)
{
$object->fetch_thirdparty();

View File

@ -110,7 +110,8 @@ class pdf_rouget extends ModelePdfExpedition
$outputlangs->load("propal");
$outputlangs->load("deliveries");
$outputlangs->load("sendings");
$outputlangs->load("productbatch");
$nblignes = count($object->lines);
// Loop on each lines to detect if there is at least one image to show

View File

@ -167,7 +167,7 @@ class pdf_crabe extends ModelePDFFactures
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
{
global $user,$langs,$conf,$mysoc,$db,$hookmanager;
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
@ -252,7 +252,7 @@ class pdf_crabe extends ModelePDFFactures
// Set nblignes with the new facture lines content after hook
$nblignes = count($object->lines);
// Create pdf instance
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
@ -337,6 +337,11 @@ class pdf_crabe extends ModelePDFFactures
$height_incoterms = 0;
if ($conf->incoterm->enabled)
{
if (is_object($object->thirdparty))
{
$object->fk_incoterms=$object->thirdparty->fk_incoterms;
$object->location_incoterms=$object->thirdparty->location_incoterms;
}
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms)
{
@ -550,7 +555,7 @@ class pdf_crabe extends ModelePDFFactures
} else {
$tvaligne = $sign * $object->lines[$i]->total_tva;
}
$localtax1ligne=$object->lines[$i]->total_localtax1;
$localtax2ligne=$object->lines[$i]->total_localtax2;
$localtax1_rate=$object->lines[$i]->localtax1_tx;
@ -1557,7 +1562,7 @@ class pdf_crabe extends ModelePDFFactures
$posy=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
$posx=$this->marge_gauche;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80;
$hautcadre=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 38 : 40;
$widthrecbox=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82;

View File

@ -69,7 +69,7 @@ class modProductBatch extends DolibarrModules
$this->config_page_url = array();
// Dependencies
$this->depends = array("modProduct","modStock","modExpedition","modSupplier"); // List of modules id that must be enabled if this module is enabled. modExpedition is required to manage batch exit (by manual stock decrease on shipment), modSupplier to manage batch entry (after supplier order).
$this->depends = array("modProduct","modStock","modExpedition","modFournisseur"); // List of modules id that must be enabled if this module is enabled. modExpedition is required to manage batch exit (by manual stock decrease on shipment), modSupplier to manage batch entry (after supplier order).
$this->requiredby = array(); // List of modules id to disable if this one is disabled
$this->phpmin = array(5,0); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(3,0); // Minimum version of Dolibarr required by module

View File

@ -712,7 +712,7 @@ if (! empty($id) && $action != 'edit')
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?rowid='.$object->id.'&action=valid_promesse">'.$langs->trans("ValidPromess").'</a></div>';
}
if (($object->statut == 0 || $object->statut == 1) && $remaintopay == 0 && $object->paye == 0)
if (($object->statut == 0 || $object->statut == 1) && $remaintopay == 0 && $object->paid == 0)
{
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?rowid='.$object->id.'&action=set_cancel">'.$langs->trans("ClassifyCanceled")."</a></div>";
}

View File

@ -31,7 +31,7 @@
*/
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr');
if (! defined('DOL_VERSION')) define('DOL_VERSION','3.9.3');
if (! defined('DOL_VERSION')) define('DOL_VERSION','3.9.4');
if (! defined('EURO')) define('EURO',chr(128));

View File

@ -296,6 +296,7 @@ if ($resql)
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"fac.ref,fac.rowid","",$param,"",$sortfield,$sortorder);
if (empty($conf->global->SUPPLIER_INVOICE_HIDE_REF_SUPPLIER)) print_liste_field_titre($langs->trans("RefSupplier"),$_SERVER["PHP_SELF"],"ref_supplier","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"fac.datef,fac.rowid","",$param,'align="center"',$sortfield,$sortorder);

View File

@ -7,6 +7,7 @@
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
*
* 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
@ -109,7 +110,7 @@ if ($action == 'setModuleOptions')
}
}
if ($action == 'other' && GETPOST('value_PRODUIT_LIMIT_SIZE') > 0)
if ($action == 'other' && GETPOST('value_PRODUIT_LIMIT_SIZE') >= 0)
{
$res = dolibarr_set_const($db, "PRODUIT_LIMIT_SIZE", GETPOST('value_PRODUIT_LIMIT_SIZE'),'chaine',0,'',$conf->entity);
}

View File

@ -1936,11 +1936,10 @@ class Societe extends CommonObject
{
global $langs;
$contact_emails = $this->contact_property_array('email');
$contact_emails = $this->contact_property_array('email',1);
if ($this->email && $addthirdparty)
{
if (empty($this->name)) $this->name=$this->nom;
// TODO: Tester si email non deja present dans tableau contact
$contact_emails['thirdparty']=$langs->trans("ThirdParty").': '.dol_trunc($this->name,16)." &lt;".$this->email."&gt;";
}
return $contact_emails;

View File

@ -5,7 +5,6 @@
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
*
* 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
@ -353,17 +352,16 @@ $parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields as ef on (s.rowid = ef.fk_object)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays) ";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent) ";
$sql.= " ,".MAIN_DB_PREFIX."c_stcomm as st";
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " , ".MAIN_DB_PREFIX."societe_extrafields as ef ";
// We'll need this table joined to the select in order to filter by sale
if ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
// We'll need this table joined to the select in order to filter by categ
if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_".($type=='f'?"fournisseur":"societe")." as cs";
$sql.= " WHERE s.fk_stcomm = st.id";
$sql.= " AND s.entity IN (".getEntity('societe', 1).")";
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " AND s.rowid = ef.fk_object";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND s.rowid = ".$socid;
if ($search_sale) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale