From fa73dbe8e9593f719545bc0435742a8f13dabe68 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Thu, 30 Jun 2016 15:12:35 +0200 Subject: [PATCH 01/33] FIX #5128 if create method return duplicated code error not use GETPOST in order to get a new code --- htdocs/langs/en_US/companies.lang | 1 + htdocs/societe/soc.php | 21 +++++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index e31c347605e..0c1fda4305a 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -432,3 +432,4 @@ MergeThirdparties=Merge third parties ConfirmMergeThirdparties=Are you sure you want to merge this third party into the current one ? All linked objects (invoices, orders, ...) will be moved to current third party so you will be able to delete the duplicate one. ThirdpartiesMergeSuccess=Thirdparties have been merged ErrorThirdpartiesMerge=There was an error when deleting the thirdparties. Please check the log. Changes have been reverted. +NewCustomerSupplierCodeProposed=New customer or supplier proposed on duplicate code diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 012aaf374e2..3c4343f322c 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -437,7 +437,7 @@ if (empty($reshook)) if (empty($object->fournisseur)) $object->code_fournisseur=''; $result = $object->create($user); - if ($result >= 0) + if ($result >= 0) { if ($object->particulier) { @@ -505,6 +505,13 @@ if (empty($reshook)) } else { + + if($result == -3) { + $duplicate_code_error = true; + $object->code_fournisseur = null; + $object->code_client = null; + } + $error=$object->error; $errors=$object->errors; } @@ -794,8 +801,14 @@ else $object->particulier = $private; $object->prefix_comm = GETPOST('prefix_comm'); $object->client = GETPOST('client')?GETPOST('client'):$object->client; - $object->code_client = GETPOST('code_client', 'alpha'); - $object->fournisseur = GETPOST('fournisseur')?GETPOST('fournisseur'):$object->fournisseur; + + if(empty($duplicate_code_error)) { + $object->code_client = GETPOST('code_client', 'alpha'); + $object->fournisseur = GETPOST('fournisseur')?GETPOST('fournisseur'):$object->fournisseur; + } else { + setEventMessages($langs->trans('NewCustomerSupplierCodeProposed'),'', 'warnings'); + } + $object->code_fournisseur = GETPOST('code_fournisseur', 'alpha'); $object->address = GETPOST('address', 'alpha'); $object->zip = GETPOST('zipcode', 'alpha'); @@ -1000,7 +1013,7 @@ else print ''.fieldLabel('CustomerCode','customer_code').''; print ''; print ''; - print ''; - print ''; + if (! empty($user->fk_soc)) // No need to show this for external users + { + print ''; + print ''; + } print '
'; - $tmpcode=$object->code_client; + $tmpcode=$object->code_client; if (empty($tmpcode) && ! empty($modCodeClient->code_auto)) $tmpcode=$modCodeClient->getNextValue($object,0); print ''; print ''; From 4503659cba8707a6ef2bc2e704d84cbc09c286c5 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 6 Jul 2016 16:50:10 +0200 Subject: [PATCH 02/33] Fix: wrong multicompany filter --- htdocs/product/index.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 83366690476..cfa936346b4 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -372,14 +372,13 @@ function activitytrim($product_type) // breakdown by quarter $sql = "SELECT DATE_FORMAT(p.datep,'%Y') as annee, DATE_FORMAT(p.datep,'%m') as mois, SUM(fd.total_ht) as Mnttot"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as fd"; + $sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as fd"; $sql.= " , ".MAIN_DB_PREFIX."paiement as p,".MAIN_DB_PREFIX."paiement_facture as pf"; - $sql.= " WHERE f.fk_soc = s.rowid"; + $sql.= " WHERE f.entity = " . $conf->entity; $sql.= " AND f.rowid = fd.fk_facture"; $sql.= " AND pf.fk_facture = f.rowid"; $sql.= " AND pf.fk_paiement= p.rowid"; $sql.= " AND fd.product_type=".$product_type; - $sql.= " AND s.entity IN (".getEntity('societe', 1).")"; $sql.= " AND p.datep >= '".$db->idate(dol_get_first_day($yearofbegindate),1)."'"; $sql.= " GROUP BY annee, mois "; $sql.= " ORDER BY annee, mois "; From 1232e25859099c5d63b8fbaa11c77facc0a8627e Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Sat, 16 Jul 2016 20:00:55 +0200 Subject: [PATCH 03/33] FIX #5474 Country_id of "Don" object is still empty --- htdocs/don/class/don.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 2b84f0d0727..45dd027212b 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2009 Regis Houssin * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2016 Juanjo Menent * * 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 @@ -645,7 +646,7 @@ class Don extends CommonObject $this->town = $obj->town; $this->zip = $obj->zip; $this->town = $obj->town; - $this->country_id = $obj->country_id; + $this->country_id = $obj->fk_country; $this->country_code = $obj->country_code; $this->country = $obj->country; $this->country_olddata= $obj->country_olddata; // deprecated From 587484fabb51e63e4d6db88a183127f328bd726d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Jul 2016 20:03:04 +0200 Subject: [PATCH 04/33] Prepare 3.9.3 --- ChangeLog | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/ChangeLog b/ChangeLog index 052b8bcaaf1..d8d87f2a6c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,41 @@ Upgrading to any other version or any other database system is abolutely require 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 +FIX: #4455 +FIX: #4749 +FIX: #4756 +FIX: #4828 +FIX: #4926 +FIX: #4964 buyprice in customer from shipping buyprice wasn't load in expedition::fetch_lines +FIX: #5004 +FIX: #5068 +FIX: #5170 tva sign with INVOICE_POSITIVE_CREDIT_NOTE option +FIX: #5338 use of not initialized var $aphour, $apmin, etc +FIX: #5343 +FIX: #5380 +FIX: #5383 bad object id on don delete +FIX: #5414 +FIX: #5470 User of expense report in bank transactions page is not correct +FIX: a case of corrupted ODT by Word that insert when it should not. +FIX: Can't create thirdparty or validate invoice if profid is mandatory and profid does not exists for other countries +FIX: dasboard wrong for late invoice +FIX: duplicate jquery.js files +FIX: extrafield cloned on project clone +FIX: Failed to open file +FIX: Filter on opportunity amount and budget +FIX: form_confirm to delete payment on supplier invoice +FIX: javascript error with german-switzerland language +FIX: large expense note +FIX: Missing original .js file (license violation if sources are not provided) +FIX: Option strict mode compatibility +FIX: product stats all bloc module without enbaled test +FIX: receiving link never works +FIX: task ODT company object not correctly retrieved +FIX: Translate group perms as it is done into user perms +FIX: We must take the last recent defined price when using price level ***** ChangeLog for 3.9.2 compared to 3.9.1 ***** FIX: #4813 Won translation for the key OppStatusWON instead OppStatusWIN From 8a303fd4d8e1d98a11f85423eeb749417dbb4c09 Mon Sep 17 00:00:00 2001 From: Xebax Date: Sat, 16 Jul 2016 20:16:46 +0200 Subject: [PATCH 05/33] FIX #5493 The login field is ignored when doing a "search in all" for members. --- htdocs/adherents/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index e4260388ac7..cee9683ef9d 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -81,7 +81,7 @@ $extrafields = new ExtraFields($db); // List of fields to search into when doing a "search in all" $fieldstosearchall = array( 'd.rowid'=>'Ref', - //'d.ref'=>'Ref', + 'd.login'=>'Login', 'd.lastname'=>'Lastname', 'd.firstname'=>'Firstname', 'd.societe'=>"Company", From 653bfd5d43e1737ec3fcd8ca520d65812ded817e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Jul 2016 22:19:26 +0200 Subject: [PATCH 06/33] Fix missing orig file in upload. --- build/makepack-dolibarr.pl | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 8a70ea73f2c..029bee69320 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -173,6 +173,7 @@ $build =~ s/-.*$//g; # now build is 0+nmu1 for example $FILENAMEDEBNATIVE="${PROJECT}_${MAJOR}.${MINOR}.${build}"; $FILENAMEDEB="${PROJECT}_${MAJOR}.${MINOR}.${newbuild}"; +$FILENAMEDEBSHORT="${PROJECT}_${MAJOR}.${MINOR}.${build}"; my $copyalreadydone=0; @@ -388,10 +389,15 @@ if ($nboftargetok) { { print 'Run git tag -a -f -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n"; $ret=`git tag -a -f -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD"`; + print 'Run git push -f --tags'."\n"; + $ret=`git push -f --tags`; } } - print 'Run git push --tags'."\n"; - $ret=`git push --tags`; + else + { + print 'Run git push --tags'."\n"; + $ret=`git push --tags`; + } chdir("$olddir"); } @@ -807,7 +813,7 @@ if ($nboftargetok) { $ret=`$cmd`; print "Remove other files\n"; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/README-FR`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/README-FR.md`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/README`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/README-FR`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/aps`; @@ -1104,6 +1110,7 @@ if ($nboftargetok) { %filestoscansf=( "$DESTI/package_rpm_generic/$FILENAMERPM"=>'Dolibarr installer for Fedora-Redhat-Mandriva-Opensuse (DoliRpm)', "$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)', + "$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'none', "$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'Dolibarr installer for Windows (DoliWamp)', "$DESTI/standard/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM', "$DESTI/standard/$FILENAMETGZ.zip"=>'Dolibarr ERP-CRM' @@ -1111,6 +1118,7 @@ if ($nboftargetok) { %filestoscanstableasso=( "$DESTI/package_rpm_generic/$FILENAMERPM"=>'package_rpm_generic', "$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'package_debian-ubuntu', + "$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'package_debian-ubuntu', "$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'package_windows', "$DESTI/standard/$FILENAMETGZ.tgz"=>'standard', "$DESTI/standard/$FILENAMETGZ.zip"=>'standard' @@ -1156,7 +1164,7 @@ if ($nboftargetok) { print "\n"; - if ($target eq 'SF') { + if ($target eq 'SF' && $filestoscan{$file} ne 'none') { $destFolder="$NEWPUBLISH/$filestoscan{$file}/".$MAJOR.'.'.$MINOR.'.'.$BUILD; } elsif ($target eq 'ASSO' and $NEWPUBLISH =~ /stable/) { From 25d9969590bd153451633a7e30ea4d4d0cedcb96 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Jul 2016 23:47:37 +0200 Subject: [PATCH 07/33] Fix watch to use orig.tar.gz on package_ubuntu directory --- build/debian/watch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/debian/watch b/build/debian/watch index a5b736c1f65..8206a7f8b7a 100644 --- a/build/debian/watch +++ b/build/debian/watch @@ -2,4 +2,4 @@ version=3 #http://sf.net/dolibarr/dolibarr-(.+)\.tgz -http://www.dolibarr.org/files/stable/standard/dolibarr-(.+)\.tgz +http://www.dolibarr.org/files/stable/package_debian-ubuntu/dolibarr_(.+)\.orig\.tar\.gz From 3b563700604f5afc24eea8b69e715b2d8a9a0162 Mon Sep 17 00:00:00 2001 From: Sergio Sanchis Climent Date: Sun, 17 Jul 2016 02:48:04 +0200 Subject: [PATCH 08/33] Fix #5450 --- htdocs/expensereport/class/expensereport.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index cc32f08b0ac..b4ea91f85b6 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1747,7 +1747,7 @@ class ExpenseReportLine // Mise a jour ligne en base $sql = "UPDATE ".MAIN_DB_PREFIX."expensereport_det SET"; $sql.= " comments='".$this->db->escape($this->comments)."'"; - $sql.= ",value_unit=".$this->value_unit.""; + $sql.= ",value_unit=".price2num($this->value_unit).""; $sql.= ",qty=".$this->qty.""; $sql.= ",date='".$this->db->idate($this->date)."'"; $sql.= ",total_ht=".$this->total_ht.""; From e6da7c557411aa2392c91cfe1f457c0db4809397 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 17 Jul 2016 07:09:17 +0200 Subject: [PATCH 09/33] Fix: Accountancy - Problem with empty accountancy acccount in create / modify mode --- htdocs/compta/bank/card.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 5ba06842c30..1553ae40b92 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -89,7 +89,8 @@ if ($_POST["action"] == 'add') $account->proprio = trim($_POST["proprio"]); $account->owner_address = trim($_POST["owner_address"]); - $account->account_number = GETPOST('account_number'); + $account_number = GETPOST('account_number','int'); + if ($account_number <= 0) { $account->account_number = ''; } else { $account->account_number = $account_number; } $account->accountancy_journal = trim($_POST["accountancy_journal"]); $account->solde = $_POST["solde"]; @@ -171,7 +172,8 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"]) $account->proprio = trim($_POST["proprio"]); $account->owner_address = trim($_POST["owner_address"]); - $account->account_number = GETPOST('account_number'); + $account_number = GETPOST('account_number', 'int'); + if ($account_number <= 0) { $account->account_number = ''; } else { $account->account_number = $account_number; } $account->accountancy_journal = trim($_POST["accountancy_journal"]); $account->currency_code = trim($_POST["account_currency_code"]); From 90a84335ab8c5e9ccf708500fd39f2e5345f1821 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 17 Jul 2016 07:34:19 +0200 Subject: [PATCH 10/33] Fix: Missing key language on home for boxes --- htdocs/langs/en_US/boxes.lang | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang index ff20b6afb1c..2e85ba36f1f 100644 --- a/htdocs/langs/en_US/boxes.lang +++ b/htdocs/langs/en_US/boxes.lang @@ -72,6 +72,11 @@ BoxProposalsPerMonth=Proposals per month NoTooLowStockProducts=No product under the low stock limit BoxProductDistribution=Products/Services distribution BoxProductDistributionFor=Distribution of %s for %s +BoxTitleLastModifiedSupplierBills=Latest %s modified supplier bills +BoxTitleLatestModifiedSupplierOrders=Latest %s modified supplier orders +BoxTitleLastModifiedCustomerBills=Latest %s modified customer bills +BoxTitleLastModifiedCustomerOrders=Latest %s modified customer orders +BoxTitleLastModifiedPropals=Latest %s modified propals ForCustomersInvoices=Customers invoices ForCustomersOrders=Customers orders ForProposals=Proposals From e52d6db3fd53ec9cdde999b4e4517a6de4aaf240 Mon Sep 17 00:00:00 2001 From: Sergio Sanchis Climent Date: Sun, 17 Jul 2016 12:18:29 +0200 Subject: [PATCH 11/33] Fix #5450 --- htdocs/expensereport/class/expensereport.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index b4ea91f85b6..83038074695 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1741,13 +1741,14 @@ class ExpenseReportLine // Clean parameters $this->comments=trim($this->comments); $this->vatrate = price2num($this->vatrate); + $this->value_unit = price2num($this->value_unit); $this->db->begin(); // Mise a jour ligne en base $sql = "UPDATE ".MAIN_DB_PREFIX."expensereport_det SET"; $sql.= " comments='".$this->db->escape($this->comments)."'"; - $sql.= ",value_unit=".price2num($this->value_unit).""; + $sql.= ",value_unit=".$this->value_unit.""; $sql.= ",qty=".$this->qty.""; $sql.= ",date='".$this->db->idate($this->date)."'"; $sql.= ",total_ht=".$this->total_ht.""; From 9b47d7e05d06078187c2e51655e577e180a962cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Jul 2016 12:46:09 +0200 Subject: [PATCH 12/33] Keep only us file --- build/debian/dolibarr.docs | 1 - 1 file changed, 1 deletion(-) diff --git a/build/debian/dolibarr.docs b/build/debian/dolibarr.docs index 5d4b554ef74..b43bf86b50f 100644 --- a/build/debian/dolibarr.docs +++ b/build/debian/dolibarr.docs @@ -1,2 +1 @@ README.md -README-FR.md From bf67cf9dc24df74a292d4df5281994cdd5efbf9d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Jul 2016 13:40:14 +0200 Subject: [PATCH 13/33] Update documentation --- build/doxygen/doxygen_footer.html | 26 ++++++++++++++++---------- build/doxygen/doxygen_header.html | 20 +++++++++++++++++--- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/build/doxygen/doxygen_footer.html b/build/doxygen/doxygen_footer.html index e11df270ddc..410e57e8c2a 100644 --- a/build/doxygen/doxygen_footer.html +++ b/build/doxygen/doxygen_footer.html @@ -4,17 +4,14 @@ File added into doxygen generated documentation - @@ -41,5 +38,14 @@ google_ad_height = 60;
+ + + + + + \ No newline at end of file diff --git a/build/doxygen/doxygen_header.html b/build/doxygen/doxygen_header.html index 0c2e189136b..fe316d2081e 100644 --- a/build/doxygen/doxygen_header.html +++ b/build/doxygen/doxygen_header.html @@ -1,6 +1,4 @@ - + @@ -14,7 +12,23 @@ File added into doxygen generated documentation + + + + + +
From bc4674bdcea071f52d6053487467b66b99db7009 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Mon, 18 Jul 2016 07:37:18 +0200 Subject: [PATCH 14/33] fix problem with call update method after fetch on invocie lines --- htdocs/compta/facture/class/facture.class.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 0ebe4f9b6ac..157f2ff6c97 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3487,7 +3487,7 @@ class Facture extends CommonInvoice $response->nbtodolate++; } } - + return $response; } else @@ -3897,7 +3897,7 @@ class Facture extends CommonInvoice global $conf; $now = dol_now(); - + // Paid invoices have status STATUS_CLOSED if ($this->statut != Facture::STATUS_VALIDATED) return false; @@ -4006,6 +4006,10 @@ class FactureLigne extends CommonInvoiceLine $sql.= ' fd.fk_unit,'; $sql.= ' fd.situation_percent, fd.fk_prev_id,'; $sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc'; + $sql.= ' , multicurrency_subprice'; + $sql.= ' , multicurrency_total_ht'; + $sql.= ' , multicurrency_total_tva'; + $sql.= ' , multicurrency_total_ttc'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as fd'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON fd.fk_product = p.rowid'; $sql.= ' WHERE fd.rowid = '.$rowid; @@ -4056,6 +4060,11 @@ class FactureLigne extends CommonInvoiceLine $this->situation_percent = $objp->situation_percent; $this->fk_prev_id = $objp->fk_prev_id; + $this->multicurrency_subprice = $objp->multicurrency_subprice; + $this->multicurrency_total_ht = $objp->multicurrency_total_ht; + $this->multicurrency_total_tva= $objp->multicurrency_total_tva; + $this->multicurrency_total_ttc= $objp->multicurrency_total_ttc; + $this->db->free($result); return 1; @@ -4309,6 +4318,11 @@ class FactureLigne extends CommonInvoiceLine if (! isset($this->situation_percent) || $this->situation_percent > 100 || (string) $this->situation_percent == '') $this->situation_percent = 100; if (empty($this->pa_ht)) $this->pa_ht=0; + if (empty($this->multicurrency_subprice)) $this->multicurrency_subprice=0; + if (empty($this->multicurrency_total_ht)) $this->multicurrency_total_ht=0; + if (empty($this->multicurrency_total_tva)) $this->multicurrency_total_tva=0; + if (empty($this->multicurrency_total_ttc)) $this->multicurrency_total_ttc=0; + // Check parameters if ($this->product_type < 0) return -1; From d3344f52910d41cc68caeaa530af80f23a27510b Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Mon, 18 Jul 2016 07:48:32 +0200 Subject: [PATCH 15/33] sd --- htdocs/compta/facture/class/facture.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 157f2ff6c97..8eaf544dad9 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4006,10 +4006,10 @@ class FactureLigne extends CommonInvoiceLine $sql.= ' fd.fk_unit,'; $sql.= ' fd.situation_percent, fd.fk_prev_id,'; $sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc'; - $sql.= ' , multicurrency_subprice'; - $sql.= ' , multicurrency_total_ht'; - $sql.= ' , multicurrency_total_tva'; - $sql.= ' , multicurrency_total_ttc'; + $sql.= ' , fd.multicurrency_subprice'; + $sql.= ' , fd.multicurrency_total_ht'; + $sql.= ' , fd.multicurrency_total_tva'; + $sql.= ' , fd.multicurrency_total_ttc'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as fd'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON fd.fk_product = p.rowid'; $sql.= ' WHERE fd.rowid = '.$rowid; From 5e654e8cb38468e02d84631999d70ddd47c8eec3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Jul 2016 11:49:34 +0200 Subject: [PATCH 16/33] Fix help --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 369dde1cf1c..8b2d46aedb3 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1523,7 +1523,7 @@ NoModueToManageStockIncrease=No module able to manage automatic stock increase h YouMayFindNotificationsFeaturesIntoModuleNotification=You may find options for EMail notifications by enabling and configuring the module "Notification". ListOfNotificationsPerContact=List of notifications per contact* ListOfFixedNotifications=List of fixed notifications -GoOntoContactCardToAddMore=Go on the tab "Notifications" of a thirdparty contact to add or remove notifications for contacts/addresses +GoOntoContactCardToAddMore=Go on the tab "Notifications" of a thirdparty to add or remove notifications for contacts/addresses Threshold=Threshold BackupDumpWizard=Wizard to build database backup dump file SomethingMakeInstallFromWebNotPossible=Installation of external module is not possible from the web interface for the following reason: From 10cd5ba7305d89b653c75e06ffb222ca7a27b515 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Jul 2016 11:54:35 +0200 Subject: [PATCH 17/33] Fix sort of sent notification by date desc --- htdocs/societe/notify/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index 40120948a3d..888459c006b 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -51,8 +51,8 @@ if ($page == -1) { $page = 0; } $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (! $sortorder) $sortorder="ASC"; -if (! $sortfield) $sortfield="c.lastname"; +if (! $sortorder) $sortorder="DESC"; +if (! $sortfield) $sortfield="a.daten"; $now=dol_now(); From 621a29d0e0ce77528d6516f49bc0c736f428fed3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Jul 2016 12:01:25 +0200 Subject: [PATCH 18/33] Fix account may contains text --- htdocs/compta/bank/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 1553ae40b92..d4de4e5efb1 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -89,7 +89,7 @@ if ($_POST["action"] == 'add') $account->proprio = trim($_POST["proprio"]); $account->owner_address = trim($_POST["owner_address"]); - $account_number = GETPOST('account_number','int'); + $account_number = GETPOST('account_number','alpha'); if ($account_number <= 0) { $account->account_number = ''; } else { $account->account_number = $account_number; } $account->accountancy_journal = trim($_POST["accountancy_journal"]); From 2c77a901b30b8a11f084f4460f240519630a0f36 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Jul 2016 12:55:44 +0200 Subject: [PATCH 19/33] Fix to avoid removal of trnaslation key to keep --- dev/translation/sanity_check_en_langfiles.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dev/translation/sanity_check_en_langfiles.php b/dev/translation/sanity_check_en_langfiles.php index 1912c8b4142..66da0eebb41 100755 --- a/dev/translation/sanity_check_en_langfiles.php +++ b/dev/translation/sanity_check_en_langfiles.php @@ -294,7 +294,9 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a if (preg_match('/^DescADHERENT_/', $value)) $qualifiedforclean=0; if (preg_match('/^SubmitTranslation/', $value)) $qualifiedforclean=0; if (preg_match('/^ModuleCompanyCode/', $value)) $qualifiedforclean=0; - + // boxes.lang + if (preg_match('/^BoxTitleLast/', $value)) $qualifiedforclean=0; + if (preg_match('/^BoxTitleLatest/', $value)) $qualifiedforclean=0; // main.lang if (preg_match('/^Duration/', $value)) $qualifiedforclean=0; if (preg_match('/^FormatDate/', $value)) $qualifiedforclean=0; From fd7c494cb672e0a2745d89fa68633fd7c2a535bd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Jul 2016 13:20:04 +0200 Subject: [PATCH 20/33] Add VAT for cyprus --- htdocs/install/mysql/data/llx_00_c_country.sql | 2 +- htdocs/install/mysql/data/llx_c_tva.sql | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/htdocs/install/mysql/data/llx_00_c_country.sql b/htdocs/install/mysql/data/llx_00_c_country.sql index d84826ed5d0..315f3c3092a 100644 --- a/htdocs/install/mysql/data/llx_00_c_country.sql +++ b/htdocs/install/mysql/data/llx_00_c_country.sql @@ -105,7 +105,7 @@ INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (74 INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (75,'CR','CRI','Costa Rica',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (76,'HR','HRV','Croatie',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (77,'CU','CUB','Cuba',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (78,'CY','CYP','Chypre',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (78,'CY','CYP','Cyprus',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (79,'CZ','CZE','République Tchèque',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (80,'DK','DNK','Danemark',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (81,'DJ','DJI','Djibouti',1,0); diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index 3d88e6bbcc9..774ffc381fc 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -81,14 +81,18 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (67 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (672, 67, '0','0','VAT Rate 0',1); -- CHINA (id country=9) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 91, 9, '17','0','VAT standard rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 92, 9, '13','0','VAT reduced rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 93, 9, '3','0','VAT super reduced rate 0',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 94, 9, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 91, 9, '17','0','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 92, 9, '13','0','VAT reduced rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 93, 9, '3','0','VAT super reduced rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 94, 9, '0','0','VAT Rate 0',1); + +-- CYPRUS (id country=78) +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (781, 78, '19','0','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (784, 78, '0','0','VAT Rate 0',1); -- DANMERK (id country=80) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (801,80, '25','0','VAT standard rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (802,80, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (801, 80, '25','0','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (802, 80, '0','0','VAT Rate 0',1); -- FRANCE (id country=1) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 11, 1, '20','0','VAT standard rate (France hors DOM-TOM)',1); From 038526bb712d77302835904876c8cc04dabaf0c5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Jul 2016 14:40:10 +0200 Subject: [PATCH 21/33] Code comment --- htdocs/install/mysql/tables/llx_product.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index 8b43844498e..1769ec6bd3e 100755 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -57,7 +57,7 @@ create table llx_product tosell tinyint DEFAULT 1, -- Product you sell tobuy tinyint DEFAULT 1, -- Product you buy onportal tinyint DEFAULT 0, -- If it is a product you sell and you want to sell it on portal (module website must be on) - tobatch tinyint DEFAULT 0 NOT NULL, -- Is it a product that need a batch or eat-by management + tobatch tinyint DEFAULT 0 NOT NULL, -- Is it a product that need a batch management (eat-by or lot management) fk_product_type integer DEFAULT 0, -- Type of product: 0 for regular product, 1 for service, 9 for other (used by external module) duration varchar(6), seuil_stock_alerte integer DEFAULT 0, @@ -81,8 +81,8 @@ create table llx_product volume_units tinyint DEFAULT NULL, stock real, -- Current physical stock (dernormalized field) pmp double(24,8) DEFAULT 0 NOT NULL, -- To store valuation of stock calculated using average price method, for this product - fifo double(24,8), -- To store valuation of stock calculated using fifo method, for this product - lifo double(24,8), -- To store valuation of stock calculated using lifo method, for this product + fifo double(24,8), -- To store valuation of stock calculated using fifo method, for this product. TODO Not used, should be replaced by stock value stored into movement table. + lifo double(24,8), -- To store valuation of stock calculated using lifo method, for this product. TODO Not used, should be replaced by stock value stored into movement table. canvas varchar(32) DEFAULT NULL, finished tinyint DEFAULT NULL, -- 1=manufactured product, 0=matiere premiere hidden tinyint DEFAULT 0, -- Not used. Deprecated. From c5ebb8f98305c9696e2feb04b66fc28c115a8d4d Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Mon, 18 Jul 2016 18:44:05 +0200 Subject: [PATCH 22/33] Fix bad param name to test if showing selector for suppliers --- htdocs/projet/element.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index a28ed69ab23..85ffae8b4b6 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2004 Rodolphe Quiedeville * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin - * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2012-2016 Juanjo Menent * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2015 Marcos García * @@ -581,7 +581,7 @@ foreach ($listofreferent as $key => $value) $addform=''; $idtofilterthirdparty=0; - if (! in_array($tablename, array('facture_fourn', 'commande_fourn'))) $idtofilterthirdparty=$object->thirdparty->id; + if (! in_array($tablename, array('facture_fourn', 'commande_fournisseur'))) $idtofilterthirdparty=$object->thirdparty->id; if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty > 0) { From 5ea72c8d5664a7adeedde9c37a0e12149e9bf573 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Tue, 19 Jul 2016 07:46:27 +0200 Subject: [PATCH 23/33] FIX : cannot update bank account on invoice if module order not activated --- htdocs/compta/facture.php | 42 +++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 04951cbb6cd..659bcaae7c4 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -407,7 +407,7 @@ if (empty($reshook)) } } } - + $qualified_for_stock_change = 0; if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $qualified_for_stock_change = $object->hasProductsOrServices(2); @@ -962,7 +962,7 @@ if (empty($reshook)) dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines or deposit lines"); $result = $srcobject->fetch($object->origin_id); - + // If deposit invoice if ($_POST['type'] == Facture::TYPE_DEPOSIT) { @@ -1130,7 +1130,7 @@ if (empty($reshook)) $error ++; } } - + // Now we create same links to contact than the ones found on origin object if (empty($conf->global->INVOICE_NO_PROPAGATE_CONTACTS_FROM_ORIGIN)) { @@ -1143,24 +1143,24 @@ if (empty($reshook)) } $sqlcontact = "SELECT code, fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc"; $sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'"; - + $resqlcontact = $db->query($sqlcontact); if ($resqlcontact) { while($objcontact = $db->fetch_object($resqlcontact)) { - //print $objcontact->code.'-'.$objcontact->fk_socpeople."\n"; + //print $objcontact->code.'-'.$objcontact->fk_socpeople."\n"; $object->add_contact($objcontact->fk_socpeople, $objcontact->code); } } - else dol_print_error($resqlcontact); - } + else dol_print_error($resqlcontact); + } } else { setEventMessages($object->error, $object->errors, 'errors'); $error ++; } - } - else + } + else { // If some invoice's lines coming from page $id = $object->create($user); @@ -1317,7 +1317,7 @@ if (empty($reshook)) // Ecrase $txtva par celui du produit // Ecrase $base_price_type par celui du produit // Replaces $fk_unit with the product's - if (! empty($idprod)) + if (! empty($idprod)) { $prod = new Product($db); $prod->fetch($idprod); @@ -1328,7 +1328,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; @@ -1375,13 +1375,13 @@ if (empty($reshook)) } // On reevalue prix selon taux tva car taux tva transaction peut etre different // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). - elseif ($tva_tx != $prod->tva_tx) + elseif ($tva_tx != $prod->tva_tx) { - if ($price_base_type != 'HT') + if ($price_base_type != 'HT') { $pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU'); } - else + else { $pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU'); } @@ -1443,7 +1443,7 @@ if (empty($reshook)) // Local Taxes $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr); $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr); - + $info_bits = 0; if ($tva_npr) $info_bits |= 0x01; @@ -1546,7 +1546,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 - + // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); @@ -2028,7 +2028,7 @@ if ($action == 'create') { $invoice_predefined = new FactureRec($db); $invoice_predefined->fetch(GETPOST('fac_rec','int')); - + $sql = 'SELECT r.rowid, r.titre, r.total_ttc'; $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as r'; $sql .= ' WHERE r.fk_soc = ' . $invoice_predefined->socid; @@ -2983,7 +2983,7 @@ else if ($id > 0 || ! empty($ref)) // Remise dispo de type avoir if (! $absolute_discount) print '
'; - // $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, $resteapayer + // $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, $resteapayer $more=' ('.$addcreditnote.')'; $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, 0, $more); // We allow credit note even if amount is higher } @@ -3316,7 +3316,7 @@ else if ($id > 0 || ! empty($ref)) print ''; print '
'; print $langs->trans('BankAccount'); print ''; - if (($action != 'editbankaccount') && $user->rights->commande->creer && ! empty($object->brouillon)) + if (($action != 'editbankaccount') && $user->rights->facture->creer && ! empty($object->brouillon)) print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).'
'; print '
'; @@ -3754,7 +3754,7 @@ else if ($id > 0 || ! empty($ref)) print ''; } } - + // Create a credit note if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut > 0 && $user->rights->facture->creer) { @@ -3912,7 +3912,7 @@ else if ($id > 0 || ! empty($ref)) { include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'inv'.$object->id); - } + } $formmail->withfrom = 1; $liste = array(); foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) { From 01c140ecacb63aacdcfe10a459be5ce926091a0b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Jul 2016 02:16:10 +0200 Subject: [PATCH 24/33] FIX External user must not be able to edit its discounts --- htdocs/comm/remx.php | 66 +++++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 28 deletions(-) diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index a4aff6d71c1..e358b842d2d 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -130,7 +130,7 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes') } } -if ($action == 'setremise') +if ($action == 'setremise' && $user->rights->societe->creer) { //if ($user->rights->societe->creer) //if ($user->rights->facture->creer) @@ -257,38 +257,48 @@ if ($socid > 0) print '
'.$langs->trans("CustomerAbsoluteDiscountAllUsers").''.$remise_all.' '.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'
'.$langs->trans("CustomerAbsoluteDiscountMy").''.$remise_user.' '.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'
'.$langs->trans("CustomerAbsoluteDiscountMy").''.$remise_user.' '.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'
'; - print '
'; - - print load_fiche_titre($langs->trans("NewGlobalDiscount"),'',''); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print "
'.$langs->trans("AmountHT").''; - print ' '.$langs->trans("Currency".$conf->currency).'
'.$langs->trans("VAT").''; - print $form->load_tva('tva_tx',GETPOST('tva_tx'),$mysoc,$object); - print '
'.$langs->trans("NoteReason").'
"; + if ($user->rights->societe->creer) + { + print '
'; + + print load_fiche_titre($langs->trans("NewGlobalDiscount"),'',''); + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + print "
'.$langs->trans("AmountHT").''; + print ' '.$langs->trans("Currency".$conf->currency).'
'.$langs->trans("VAT").''; + print $form->load_tva('tva_tx',GETPOST('tva_tx'),$mysoc,$object); + print '
'.$langs->trans("NoteReason").'
"; + } + print ''; dol_fiche_end(); - print '
'; - print ''; - if (! empty($backtopage)) - { - print '     '; - print ''; - } - print '
'; - + if ($user->rights->societe->creer) + { + print '
'; + print ''; + if (! empty($backtopage)) + { + print '     '; + print ''; + } + print '
'; + } + print ''; @@ -414,7 +424,7 @@ if ($socid > 0) print '
'; /* - * Liste ristournes appliquees (=liees a une ligne de facture ou facture) + * List discount consumed (=liees a une ligne de facture ou facture) */ // Remises liees a lignes de factures From 918bc9cc2621dc16423e7626a1e887da54941d16 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Jul 2016 16:07:15 +0200 Subject: [PATCH 25/33] Fix: If user can approve, show button to deny to. --- htdocs/expensereport/card.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index e7089e9d4f9..afb4fdacc6e 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1984,6 +1984,11 @@ if ($action != 'create' && $action != 'edit') } } + if ($user->rights->expensereport->approve && $object->fk_statut == 5) + { + print 'id.'">'.$langs->trans('Deny').''; + } + /* Si l'état est "A payer" * ET user à droit de "to_paid" * Afficher : "Annuler" / "Payer" / "Supprimer" From 52e5403660d68fa89dd1a9515a2eb01332284e4e Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 21 Jul 2016 06:25:25 +0200 Subject: [PATCH 26/33] Fix: Presentation on thirdparty card --- htdocs/societe/soc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 0d6283db216..40616987aaa 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -2171,7 +2171,7 @@ else print ''; // Legal - print ''; + print ''; // Capital print ''; print ''; } print ''; print ''; print ''; From 80354cd8d624491a202603a9cf41861f4502b8d4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Jul 2016 18:43:44 +0200 Subject: [PATCH 32/33] FIX Can correct stock of lot using eatby or sell by date --- htdocs/product/stock/mouvement.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index d5deffb2c12..0a979a0add7 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -109,8 +109,12 @@ if ($action == "correct_stock") if ($product->hasbatch()) { $batch=GETPOST('batch_number'); - $eatby=GETPOST('eatby'); - $sellby=GETPOST('sellby'); + + //$eatby=GETPOST('eatby'); + //$sellby=GETPOST('sellby'); + $eatby=dol_mktime(12, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear')); + $sellby=dol_mktime(12, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear')); + $result=$product->correct_stock_batch( $user, $id, From f90946dbde3bc277dbf9f8efd071867c842bf98e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Jul 2016 19:12:05 +0200 Subject: [PATCH 33/33] Fix test on eat and sell date --- .../product/stock/class/mouvementstock.class.php | 15 +++++++++++++-- htdocs/product/stock/tpl/stockcorrection.tpl.php | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index a19a39beb45..7df27c9383c 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -149,8 +149,12 @@ class MouvementStock extends CommonObject { if ($eatby) { - if ($this->db->jdate($obj->eatby) != $eatby) // If found and eatby/sellby defined into table and provided and differs, return error + $eatbywithouthour=$eatby; + $tmparray=dol_getdate($eatby, true); + $eatbywithouthour=dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); + if ($this->db->jdate($obj->eatby) != $eatby && $this->db->jdate($obj->eatby) != $eatbywithouthour) // We test date without hours and with hours for backward compatibility { + // If found and eatby/sellby defined into table and provided and differs, return error $this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby)), dol_print_date($eatby)); dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby)), dol_print_date($eatby)), LOG_ERR); $this->db->rollback(); @@ -183,8 +187,12 @@ class MouvementStock extends CommonObject { if ($sellby) { - if ($this->db->jdate($obj->sellby) != $sellby) // If found and eatby/sellby defined into table and provided and differs, return error + $sellbywithouthour=$sellby; + $tmparray=dol_getdate($eatby, true); + $eatbywithouthour=dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); + if ($this->db->jdate($obj->sellby) != $sellby && $this->db->jdate($obj->sellby) != $sellbywithouthour) // We test date without hours and with hours for backward compatibility { + // If found and eatby/sellby defined into table and provided and differs, return error $this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby)); dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby)), LOG_ERR); $this->db->rollback(); @@ -222,6 +230,9 @@ class MouvementStock extends CommonObject $productlot = new Productlot($this->db); $productlot->fk_product = $fk_product; $productlot->batch = $batch; + // If we are here = first time we manage this batch, so we used dates provided by users to create lot + $productlot->eatby = $eatby; + $productlot->sellby = $sellby; $result = $productlot->create($user); if ($result <= 0) { diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index 522e8d2899b..b7afe0e6804 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -56,7 +56,7 @@ { print ''; print ''; } if ($object->element == 'stock')
'.$langs->trans('JuridicalStatus').''.$object->forme_juridique.'
'.$langs->trans('JuridicalStatus').''.$object->forme_juridique.'
'.$langs->trans('Capital').''; From ff9b2803e7dee27a2160a3f32a7539e5766dda11 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Jul 2016 12:15:53 +0200 Subject: [PATCH 27/33] Fix if previous percent not defined, we do not try to show previous percent. --- htdocs/projet/card.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 62a5a8fd3f1..1b43eb1dd39 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -849,10 +849,9 @@ else var defaultpercent = element.attr("defaultpercent"); var elemcode = element.attr("elemcode"); /* Change percent of default percent of new status is higher */ - if (parseFloat(jQuery("#opp_percent").val()) != parseFloat(defaultpercent) - ) + if (parseFloat(jQuery("#opp_percent").val()) != parseFloat(defaultpercent)) { - if (! jQuery("#oldopppercent").text()) jQuery("#oldopppercent").text(\' - '.dol_escape_js($langs->trans("PreviousValue")).': \'+jQuery("#opp_percent").val()+\' %\'); + if (jQuery("#opp_percent").val() != \'\' && ! jQuery("#oldopppercent").text()) jQuery("#oldopppercent").text(\' - '.dol_escape_js($langs->trans("PreviousValue")).': \'+jQuery("#opp_percent").val()+\' %\'); jQuery("#opp_percent").val(defaultpercent); } From 058c431483c3cc0dacf689cd534f66ad5350e2ce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Jul 2016 13:49:10 +0200 Subject: [PATCH 28/33] FIX The project was lost when creating the event "sent by email". Also, event company "create" was not tracked by default like others. --- htdocs/comm/propal/card.php | 2 +- htdocs/core/class/html.formmail.class.php | 10 ++++++++-- htdocs/core/modules/modAgenda.class.php | 2 +- .../interface_50_modAgenda_ActionsAuto.class.php | 7 ++++--- htdocs/install/mysql/data/llx_c_action_trigger.sql | 8 ++++---- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 1e580826e96..cd1734ff0a5 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2417,7 +2417,7 @@ if ($action == 'create') // Tableau des substitutions $formmail->setSubstitFromObject($object); - $formmail->substit['__PROPREF__'] = $object->ref; + $formmail->substit['__PROPREF__'] = $object->ref; // For backward compatibility // Find the good contact adress $custcontact = ''; diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index a159b7e6b18..6832bc33f43 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -935,11 +935,17 @@ class FormMail extends Form { global $user; $this->substit['__REF__'] = $object->ref; - $this->substit['__SIGNATURE__'] = $user->signature; $this->substit['__REFCLIENT__'] = $object->ref_client; - $this->substit['__THIRDPARTY_NAME__'] = $object->thirdparty->name; + $this->substit['__REFSUPPLIER__'] = $object->ref_supplier; + + $this->substit['__THIRDPARTY_ID__'] = (is_object($object->thirdparty)?$object->thirdparty->id:''); + $this->substit['__THIRDPARTY_NAME__'] = (is_object($object->thirdparty)?$object->thirdparty->name:''); + + $this->substit['__PROJECT_ID__'] = (is_object($object->projet)?$object->projet->id:''); $this->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:''); $this->substit['__PROJECT_NAME__'] = (is_object($object->projet)?$object->projet->title:''); + + $this->substit['__SIGNATURE__'] = $user->signature; $this->substit['__PERSONALIZED__'] = ''; $this->substit['__CONTACTCIVNAME__'] = ''; // Will be replace just before sending } diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 0d0720d7440..03705f5dcef 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -82,7 +82,7 @@ class modAgenda extends DolibarrModules { while ($obj = $this->db->fetch_object($sqlreadactions)) { - if (preg_match('/_CREATE$/',$obj->code)) continue; // We don't track such events (*_CREATE) by default. + if (preg_match('/_CREATE$/',$obj->code) && ($obj->code != 'COMPANY_CREATE')) continue; // We don't track such events (*_CREATE) by default, we prefer validation (except thirdparty creation because there is no validation). if (preg_match('/^PROJECT_/',$obj->code)) continue; // We don't track such events by default. if (preg_match('/^TASK_/',$obj->code)) continue; // We don't track such events by default. $this->const[] = array('MAIN_AGENDA_ACTIONAUTO_'.$obj->code, "chaine", "1"); diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 5c85309ed8c..2f9c1a132d5 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -43,13 +43,13 @@ class InterfaceActionsAuto extends DolibarrTriggers * Function called when a Dolibarrr business event is done. * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared) * - * Following properties must be filled: + * Following properties may be set before calling trigger. The may be completed by this trigger to be used for writing the event into database: * $object->actiontypecode (translation action code: AC_OTH, ...) * $object->actionmsg (note, long text) * $object->actionmsg2 (label, short text) * $object->sendtoid (id of contact) * $object->socid - * Optionnal: + * $object->fk_project * $object->fk_element * $object->elementtype * @@ -779,6 +779,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $actioncomm->code = 'AC_'.$action; $actioncomm->label = $object->actionmsg2; $actioncomm->note = $object->actionmsg; // TODO Replace with $actioncomm->email_msgid ? $object->email_content : $object->actionmsg + $actioncomm->fk_project = isset($object->fk_project)?$object->fk_project:0; $actioncomm->datep = $now; $actioncomm->datef = $now; $actioncomm->durationp = 0; @@ -790,7 +791,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $actioncomm->contactid = $contactforaction->id; $actioncomm->authorid = $user->id; // User saving action $actioncomm->userownerid = $user->id; // Owner of action - // Fields when action is en email (coentent should be into note) + // Fields when action is en email (content should be added into note) $actioncomm->email_msgid = $object->email_msgid; $actioncomm->email_from = $object->email_from; $actioncomm->email_sender= $object->email_sender; diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql index 81ce72007ab..b35d08036b3 100644 --- a/htdocs/install/mysql/data/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql @@ -50,11 +50,11 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_CANCEL','Customer invoice canceled','Executed when a customer invoice is conceled','facture',8); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SENTBYMAIL','Customer invoice sent by mail','Executed when a customer invoice is sent by mail','facture',9); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_UNVALIDATE','Customer invoice unvalidated','Executed when a customer invoice status set back to draft','facture',10); -insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_CREATE','Supplier order validated','Executed when a supplier order is validated','order_supplier',11); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_CREATE','Supplier order created','Executed when a supplier order is created','order_supplier',11); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_VALIDATE','Supplier order validated','Executed when a supplier order is validated','order_supplier',12); -insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_APPROVE','Supplier order request approved','Executed when a supplier order is approved','order_supplier',12); -insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_SUBMIT','Supplier order request submited','Executed when a supplier order is approved','order_supplier',12); -insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_RECEIVE','Supplier order request received','Executed when a supplier order is received','order_supplier',12); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_APPROVE','Supplier order request approved','Executed when a supplier order is approved','order_supplier',13); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_SUBMIT','Supplier order request submited','Executed when a supplier order is approved','order_supplier',13); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_RECEIVE','Supplier order request received','Executed when a supplier order is received','order_supplier',13); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_REFUSE','Supplier order request refused','Executed when a supplier order is refused','order_supplier',13); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_SENTBYMAIL','Supplier order sent by mail','Executed when a supplier order is sent by mail','order_supplier',14); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_CLASSIFY_BILLED','Supplier order set billed','Executed when a supplier order is set as billed','order_supplier',14); From 42be661b1d60b177b8322c4d79f2026c3bc93767 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Jul 2016 17:35:23 +0200 Subject: [PATCH 29/33] Fix bad error message output --- htdocs/commande/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index f3240443a6e..d91ee35fe3e 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -523,7 +523,7 @@ if (empty($reshook)) else if ($action == 'setmode' && $user->rights->commande->creer) { $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); if ($result < 0) - dol_print_error($db, $object->error); + setEventMessages($object->error, $object->errors, 'errors'); } // Multicurrency Code @@ -539,13 +539,13 @@ if (empty($reshook)) else if ($action == 'setavailability' && $user->rights->commande->creer) { $result = $object->availability(GETPOST('availability_id')); if ($result < 0) - dol_print_error($db, $object->error); + setEventMessages($object->error, $object->errors, 'errors'); } else if ($action == 'setdemandreason' && $user->rights->commande->creer) { $result = $object->demand_reason(GETPOST('demand_reason_id')); if ($result < 0) - dol_print_error($db, $object->error); + setEventMessages($object->error, $object->errors, 'errors'); } else if ($action == 'setconditions' && $user->rights->commande->creer) { From 441a8c4a74462643243c4dea038ce062d7de427c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Jul 2016 18:28:06 +0200 Subject: [PATCH 30/33] FIX Can make a movement on "out of sell" products --- htdocs/product/stock/tpl/stockcorrection.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index dc102d8eb05..d6c603332b5 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -61,7 +61,7 @@ $langs->load("productbatch"); { print ''.$langs->trans("Product").''; - print $form->select_produits(GETPOST('product_id'),'product_id',(empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':'')); + print $form->select_produits(GETPOST('product_id'),'product_id',(empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''),20,0,-1); print ''; From 2d037eb34eb427f9af13d07a6dbf334f480c7ab0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 15 Jul 2016 19:35:00 +0200 Subject: [PATCH 31/33] FIX Direction of movement lost if an error occurs --- htdocs/product/stock/tpl/stockcorrection.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index d6c603332b5..3cb8ba47298 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -67,7 +67,7 @@ $langs->load("productbatch"); print ''; print ''.$langs->trans("NumberOfUnit").'
'.$langs->trans("Warehouse").''; - print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot','int'):'ifone')), 'id_entrepot', '', 1); + print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot','int'):'ifone')), 'id_entrepot', '', 1, 0, 0, '', 0, 0, null, 'minwidth100'); print '