From f8a68b04498de8d42c6a620ae833d0d36ed4fc4c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Feb 2014 20:57:22 +0100 Subject: [PATCH 01/13] Fix: Missing translation --- htdocs/compta/sociales/index.php | 3 +++ htdocs/compta/tva/index.php | 3 +++ 2 files changed, 6 insertions(+) diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index 2c5f1736d1b..d59a414550d 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -32,6 +32,9 @@ $socid = isset($_GET["socid"])?$_GET["socid"]:''; if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'tax', '', '', 'charges'); +$langs->load("compta"); +$langs->load("banks"); +$langs->load("bills"); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index 354d8c86535..469b1121d61 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -29,6 +29,9 @@ require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->load("other"); +$langs->load("compta"); +$langs->load("banks"); +$langs->load("bills"); $year=$_GET["year"]; if ($year == 0 ) From d8e5fd20d298fa4fe63e5bb931d986c2fa2379ba Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Mon, 10 Feb 2014 09:39:26 +0100 Subject: [PATCH 02/13] In certain case, holiday_users won't be update (1 delete, 1 add for ex) Add a fonction for count the real number of user without CP --- htdocs/holiday/class/holiday.class.php | 28 ++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index dc949344ee6..e92068ee364 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -87,7 +87,7 @@ class Holiday extends CommonObject $this->updateSoldeCP(); // Vérifie le nombre d'utilisateur et mets à jour si besoin - $this->verifNbUsers($this->countActiveUsers(),$this->getConfCP('nbUser')); + $this->verifNbUsers($this->countActiveUsersWithoutCP(),$this->getConfCP('nbUser')); return 1; } @@ -1229,7 +1229,23 @@ class Holiday extends CommonObject $sql = "SELECT count(u.rowid) as compteur"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; - $sql.= " WHERE statut > '0'"; + $sql.= " WHERE u.statut > '0'"; + + $result = $this->db->query($sql); + $objet = $this->db->fetch_object($result); + return $objet->compteur; + + } + /** + * Compte le nombre d'utilisateur actifs dans Dolibarr sans CP + * + * @return int retourne le nombre d'utilisateur + */ + function countActiveUsersWithoutCP() { + + $sql = "SELECT count(u.rowid) as compteur"; + $sql.= " FROM ".MAIN_DB_PREFIX."user as u LEFT OUTER JOIN ".MAIN_DB_PREFIX."holiday_users hu ON (hu.fk_user=u.rowid)"; + $sql.= " WHERE u.statut > 0 AND hu.fk_user IS NULL "; $result = $this->db->query($sql); $objet = $this->db->fetch_object($result); @@ -1244,13 +1260,13 @@ class Holiday extends CommonObject * @param int $userCP nombre d'utilisateur actifs dans le module congés payés * @return void */ - function verifNbUsers($userDolibarr,$userCP) { + function verifNbUsers($userDolibarrWithoutCP,$userCP) { if (empty($userCP)) $userCP=0; dol_syslog(get_class($this).'::verifNbUsers userDolibarr='.$userDolibarr.' userCP='.$userCP); - // Si il y a plus d'utilisateur Dolibarr que dans le module CP - if ($userDolibarr > $userCP) + // On vérifie les users Dolibarr sans CP + if ($userDolibarrWithoutCP > 0) { $this->updateConfCP('nbUser',$userDolibarr); @@ -1311,7 +1327,7 @@ class Holiday extends CommonObject $obj = $this->db->fetch_object($resql); - // On ajoute l'utilisateur + // On supprime l'utilisateur $this->deleteCPuser($obj->fk_user); $i++; From 2e7631fa78f955f6fb7e2b0492291f398ea1ea10 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Feb 2014 15:17:33 +0100 Subject: [PATCH 03/13] Fix: translation --- htdocs/langs/en_US/products.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 806c3a4d083..21d27d839cd 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -173,8 +173,8 @@ CustomCode=Customs code CountryOrigin=Origin country HiddenIntoCombo=Hidden into select lists Nature=Nature -ProductCodeModel=Product code template -ServiceCodeModel=Service code template +ProductCodeModel=Product ref template +ServiceCodeModel=Service ref template AddThisProductCard=Create product card HelpAddThisProductCard=This option allows you to create or clone a product if it does not exist. AddThisServiceCard=Create service card From 191ff058739c27d9f6563789e2d8fa28f043ecd8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Feb 2014 18:36:49 +0100 Subject: [PATCH 04/13] Fix: W3C. --- htdocs/fichinter/fiche.php | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 576f7ac496a..1c11e1f7b3e 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -1322,9 +1322,24 @@ else if ($id > 0 || ! empty($ref)) include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; } + + + print '
'; + print ''; + print ''; + if ($action == 'editline') + { + print ''; + print ''; + } + else + { + print ''; + } + /* * Lignes d'intervention - */ + */ $sql = 'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,'; $sql.= ' ft.date as date_intervention'; $sql.= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft'; @@ -1412,11 +1427,6 @@ else if ($id > 0 || ! empty($ref)) // Ligne en mode update if ($object->statut == 0 && $action == 'editline' && $user->rights->ficheinter->creer && GETPOST('line_id','int') == $objp->rowid) { - print 'rowid.'" method="post">'; - print ''; - print ''; - print ''; - print ''; print ''; print ''; print ''; // ancre pour retourner sur la ligne @@ -1440,8 +1450,6 @@ else if ($id > 0 || ! empty($ref)) print ''; print '
'; print '' . "\n"; - - print "
\n"; } $i++; @@ -1466,12 +1474,6 @@ else if ($id > 0 || ! empty($ref)) print ' '; print "\n"; - // Ajout ligne d'intervention - print '
'; - print ''; - print ''; - print ''; - $var=false; print '\n"; @@ -1499,8 +1501,6 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; - print '
'; - if (! $num) print ''; } @@ -1511,6 +1511,8 @@ else if ($id > 0 || ! empty($ref)) dol_print_error($db); } + print ''."\n"; + print ''; print "\n"; From 55018098447f5c106b6200eef451980e9d6a69ef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Feb 2014 18:47:16 +0100 Subject: [PATCH 05/13] Fix: sql compare on int must not contains quotes. --- htdocs/holiday/class/holiday.class.php | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index e92068ee364..024ab5c30a9 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -1,8 +1,8 @@ - * Copyright (C) 2012 Laurent Destailleur - * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2013 Florian Henry +/* Copyright (C) 2011 Dimitri Mouillard + * Copyright (C) 2012-2014 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2013 Florian Henry * * 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 @@ -923,13 +923,13 @@ class Holiday extends CommonObject dol_syslog(get_class($this).'::updateSoldeCP sql='.$sql2); $result= $this->db->query($sql2); - + if ($result) return 1; else return -1; } - + return 0; - } + } else { // Mise à jour pour un utilisateur @@ -942,7 +942,7 @@ class Holiday extends CommonObject dol_syslog(get_class($this).'::updateSoldeCP sql='.$sql); $result = $this->db->query($sql); - + if ($result) return 1; else return -1; } @@ -1061,7 +1061,7 @@ class Holiday extends CommonObject $sql = "SELECT u.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; - $sql.= " WHERE statut > '0'"; + $sql.= " WHERE statut > 0"; dol_syslog(get_class($this)."::fetchUsers sql=".$sql, LOG_DEBUG); $resql=$this->db->query($sql); @@ -1143,7 +1143,7 @@ class Holiday extends CommonObject $sql = "SELECT u.rowid, u.lastname, u.firstname"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; - $sql.= " WHERE statut > '0'"; + $sql.= " WHERE statut > 0"; dol_syslog(get_class($this)."::fetchUsers sql=".$sql, LOG_DEBUG); $resql=$this->db->query($sql); @@ -1229,7 +1229,7 @@ class Holiday extends CommonObject $sql = "SELECT count(u.rowid) as compteur"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; - $sql.= " WHERE u.statut > '0'"; + $sql.= " WHERE u.statut > 0"; $result = $this->db->query($sql); $objet = $this->db->fetch_object($result); @@ -1256,8 +1256,8 @@ class Holiday extends CommonObject /** * Compare le nombre d'utilisateur actif de Dolibarr à celui des utilisateurs des congés payés * - * @param int $userDolibarr nombre d'utilisateur actifs dans Dolibarr - * @param int $userCP nombre d'utilisateur actifs dans le module congés payés + * @param int $userDolibarrWithoutCP Number of active users in Dolibarr without holidays + * @param int $userCP Number of active users into table of holidays * @return void */ function verifNbUsers($userDolibarrWithoutCP,$userCP) { @@ -1670,7 +1670,7 @@ class Holiday extends CommonObject $sql.= " cpl.new_solde"; $sql.= " FROM ".MAIN_DB_PREFIX."holiday_logs as cpl"; - $sql.= " WHERE cpl.rowid > '0'"; // Hack pour la recherche sur le tableau + $sql.= " WHERE cpl.rowid > 0"; // To avoid error with other search and criteria // Filtrage de séléction if(!empty($filter)) { From ccab2b7af4a82cd67799f33b4f1766101d835f9d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Feb 2014 19:00:06 +0100 Subject: [PATCH 06/13] Fix: Must use "null" for value when finished is not defined but not when finished is "0". --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 6a615ce01c2..e1fb258f11e 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -338,7 +338,7 @@ class Product extends CommonObject $sql.= ", ".$this->status; $sql.= ", ".$this->status_buy; $sql.= ", '".$this->canvas."'"; - $sql.= ", ".((! isset($this->finished) || $this->finished < 0)?'null':$this->finished); + $sql.= ", ".((! isset($this->finished) || $this->finished < 0 || $this->finished == '') ? 'null' : $this->finished); $sql.= ")"; dol_syslog(get_class($this)."::Create sql=".$sql); From 7d74d0d3bd7f3888632006984279bee5a57006b3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Feb 2014 22:28:16 +0100 Subject: [PATCH 07/13] CFix: The order field for prospect level was not visible making dictionnary useless. --- htdocs/admin/dict.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 217dc10fed6..c3dd24db957 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -145,7 +145,7 @@ $tabsql[12]= "SELECT c.rowid as rowid, code, sortorder, c.libelle, c.libelle_fac $tabsql[13]= "SELECT id as rowid, code, c.libelle, type, active FROM ".MAIN_DB_PREFIX."c_paiement AS c"; $tabsql[14]= "SELECT e.rowid as rowid, e.code as code, e.libelle, e.price, e.organization, e.fk_pays as country_id, p.code as country_code, p.libelle as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_pays as p WHERE e.fk_pays=p.rowid and p.active=1"; $tabsql[15]= "SELECT rowid as rowid, code, label as libelle, width, height, unit, active FROM ".MAIN_DB_PREFIX."c_paper_format"; -$tabsql[16]= "SELECT code, label as libelle, active FROM ".MAIN_DB_PREFIX."c_prospectlevel"; +$tabsql[16]= "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectlevel"; $tabsql[17]= "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_type_fees"; $tabsql[18]= "SELECT rowid as rowid, code, libelle, tracking, active FROM ".MAIN_DB_PREFIX."c_shipment_mode"; $tabsql[19]= "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_effectif"; @@ -201,7 +201,7 @@ $tabfield[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage"; $tabfield[13]= "code,libelle,type"; $tabfield[14]= "code,libelle,price,organization,country_id,country"; $tabfield[15]= "code,libelle,width,height,unit"; -$tabfield[16]= "code,libelle"; +$tabfield[16]= "code,libelle,sortorder"; $tabfield[17]= "code,libelle"; $tabfield[18]= "code,libelle,tracking"; $tabfield[19]= "code,libelle"; @@ -229,7 +229,7 @@ $tabfieldvalue[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage"; $tabfieldvalue[13]= "code,libelle,type"; $tabfieldvalue[14]= "code,libelle,price,organization,country"; $tabfieldvalue[15]= "code,libelle,width,height,unit"; -$tabfieldvalue[16]= "code,libelle"; +$tabfieldvalue[16]= "code,libelle,sortorder"; $tabfieldvalue[17]= "code,libelle"; $tabfieldvalue[18]= "code,libelle,tracking"; $tabfieldvalue[19]= "code,libelle"; @@ -257,7 +257,7 @@ $tabfieldinsert[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage"; $tabfieldinsert[13]= "code,libelle,type"; $tabfieldinsert[14]= "code,libelle,price,organization,fk_pays"; $tabfieldinsert[15]= "code,label,width,height,unit"; -$tabfieldinsert[16]= "code,label"; +$tabfieldinsert[16]= "code,label,sortorder"; $tabfieldinsert[17]= "code,libelle"; $tabfieldinsert[18]= "code,libelle,tracking"; $tabfieldinsert[19]= "code,libelle"; @@ -441,6 +441,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) if ($fieldnamekey == 'position') $fieldnamekey = 'Position'; if ($fieldnamekey == 'unicode') $fieldnamekey = 'Unicode'; if ($fieldnamekey == 'deductible') $fieldnamekey = 'Deductible'; + if ($fieldnamekey == 'sortorder') $fieldnamekey = 'SortOrder'; $msg.=$langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)).'
'; } @@ -773,6 +774,7 @@ if ($id) if ($fieldlist[$field]=='account_parent') { $valuetoshow=$langs->trans("Accountparent"); } if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); } if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); } + if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); } if ($valuetoshow != '') { print ''; @@ -887,10 +889,11 @@ if ($id) if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); } if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); $sortable=0; } if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); $sortable=0; } - if ($fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); } + if ($fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); } if ($fieldlist[$field]=='account_parent') { $valuetoshow=$langs->trans("Accountsparent"); } if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); } if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); } + if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); } // Affiche nom du champ if ($showfield) { @@ -1105,7 +1108,7 @@ if ($id) if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) $iserasable = 0; else if ($obj->code == 'RECEP') $iserasable = 0; else if ($obj->code == 'EF0') $iserasable = 0; - } + } if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) $iserasable=0; From 4b8d39af9dac45b90fb0c90114f08c174cec7ff5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Feb 2014 13:05:04 +0100 Subject: [PATCH 08/13] Fix: Do not report trigger errors twice. Fix: Error when creating event was not reported. Conflicts: htdocs/comm/action/fiche.php --- ChangeLog | 2 ++ htdocs/comm/action/fiche.php | 4 ++-- htdocs/core/class/interfaces.class.php | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8d28705d569..90b6922d60b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.5.1 compared to 3.5.0 ***** +Fix: Do not report trigger errors twice. +Fix: Error when creating event was not reported. Fix: Bug of import of agenda when using https link Fix: Field nature not saved correctly Fix: Substituion of extra field was ko for order diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index d0c6a213c77..ee20189f14f 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -261,8 +261,8 @@ if ($action == 'add_action') { $db->rollback(); $langs->load("errors"); - $error=$langs->trans($actioncomm->error); - setEventMessage($error,'errors'); + if (! empty($actioncomm->error)) setEventMessage($langs->trans($actioncomm->error), 'errors'); + if (count($actioncomm->errors)) setEventMessage($actioncomm->errors, 'errors'); $action = 'create'; } } diff --git a/htdocs/core/class/interfaces.class.php b/htdocs/core/class/interfaces.class.php index db39f7bab86..428ea65a174 100644 --- a/htdocs/core/class/interfaces.class.php +++ b/htdocs/core/class/interfaces.class.php @@ -167,8 +167,8 @@ class Interfaces // Action KO $nbtotal++; $nbko++; - if (! empty($objMod->error)) $this->errors[]=$objMod->error; if (! empty($objMod->errors)) $this->errors=array_merge($this->errors,$objMod->errors); + else if (! empty($objMod->error)) $this->errors[]=$objMod->error; } } else From 7e2027ec391b453c3e707caa6739cd3bfe7ca322 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Feb 2014 12:58:03 +0100 Subject: [PATCH 09/13] Fix: Can not set delay to zero. --- htdocs/admin/delais.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 7aeb6eb9f78..e16240bf251 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -107,7 +107,7 @@ if ($action == 'update') { foreach($delays as $delay) { - if (GETPOST($delay['code'])) + if (GETPOST($delay['code']) != '') { dolibarr_set_const($db, $delay['code'], GETPOST($delay['code']), 'chaine', 0, '', $conf->entity); } From 295f0fd9e79a243b8978225205ac507fb14acf18 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 15 Feb 2014 15:23:21 +0100 Subject: [PATCH 10/13] Makepack is for version 3.5 --- build/makepack-dolibarrmodule.pl | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/build/makepack-dolibarrmodule.pl b/build/makepack-dolibarrmodule.pl index e708340266d..62002fd063b 100755 --- a/build/makepack-dolibarrmodule.pl +++ b/build/makepack-dolibarrmodule.pl @@ -2,7 +2,7 @@ #---------------------------------------------------------------------------- # \file build/makepack-dolibarrmodule.pl # \brief Package builder (tgz, zip, rpm, deb, exe) -# \author (c)2005-2013 Laurent Destailleur +# \author (c)2005-2014 Laurent Destailleur #---------------------------------------------------------------------------- use Cwd; @@ -20,8 +20,8 @@ $GROUP="ldestailleur"; use vars qw/ $REVISION $VERSION /; -$REVISION='1.20'; -$VERSION="1.0 (build $REVISION)"; +$REVISION='1.0'; +$VERSION="3.5 (build $REVISION)"; @@ -245,18 +245,30 @@ foreach my $PROJECT (@PROJECTLIST) { if (! $result) { die "Error: Can't open conf file makepack-".$PROJECT.".conf for reading.\n"; } while() { - if ($_ =~ /^#/) { next; } # Do not process comments + $entry=$_; + + if ($entry =~ /^#/) { next; } # Do not process comments - $_ =~ s/\n//; - $_ =~ /^(.*)\/[^\/]+/; + $entry =~ s/\n//; + + if ($entry =~ /^!(.*)$/) # Exclude so remove file/dir + { + print "Remove $BUILDROOT/$PROJECTLC/$1\n"; + $ret=`rm -fr "$BUILDROOT/$PROJECTLC/"$1`; + if ($? != 0) { die "Failed to delete a file to exclude declared into makepack-".$PROJECT.".conf file (Fails on line ".$entry.")\n"; } + next; + } + + $entry =~ /^(.*)\/[^\/]+/; print "Create directory $BUILDROOT/$PROJECTLC/$1\n"; $ret=`mkdir -p "$BUILDROOT/$PROJECTLC/$1"`; - if ($_ !~ /version\-/) + if ($entry !~ /version\-/) { - print "Copy $SOURCE/$_ into $BUILDROOT/$PROJECTLC/$_\n"; - $ret=`cp -pr "$SOURCE/$_" "$BUILDROOT/$PROJECTLC/$_"`; - if ($? != 0) { die "Failed to make copy of a file declared into makepack-".$PROJECT.".conf file (Fails on line ".$_.")\n"; } + print "Copy $SOURCE/$entry into $BUILDROOT/$PROJECTLC/$entry\n"; + $ret=`cp -pr "$SOURCE/$entry" "$BUILDROOT/$PROJECTLC/$entry"`; + if ($? != 0) { die "Failed to make copy of a file declared into makepack-".$PROJECT.".conf file (Fails on line ".$entry.")\n"; } } + } close IN; From b081083a1a3684eab984b740c9c02b70dd1ed5bb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 16 Feb 2014 17:07:17 +0100 Subject: [PATCH 11/13] Fix: Bad management of date. Fix: Submit button was not visible making not possible to filter on date. Fix: Use standard css style instead of hardcoded css. --- htdocs/margin/agentMargins.php | 14 +++++------ htdocs/margin/customerMargins.php | 40 +++++++++++++++++-------------- htdocs/margin/productMargins.php | 30 ++++++++++++++--------- 3 files changed, 48 insertions(+), 36 deletions(-) diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 811052f7a93..41deb207e1c 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -56,9 +56,9 @@ $pagenext = $page + 1; $startdate=$enddate=''; if (!empty($_POST['startdatemonth'])) - $startdate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear'])); + $startdate = dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']); if (!empty($_POST['enddatemonth'])) - $enddate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear'])); + $enddate = dol_mktime(12, 0, 0, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']); /* * View @@ -90,16 +90,16 @@ print $form->select_dolusers($agentid,'agentid',1); print ''; // Start date -print ''.$langs->trans('StartDate').''; +print ''.$langs->trans('StartDate').' ('.$langs->trans("DateValidation").')'; print ''; $form->select_date($startdate,'startdate','','',1,"sel",1,1); print ''; -print ''.$langs->trans('EndDate').''; +print ''.$langs->trans('EndDate').' ('.$langs->trans("DateValidation").')'; print ''; $form->select_date($enddate,'enddate','','',1,"sel",1,1); print ''; print ''; -print ''; +print ''; print ''; print ""; print ''; @@ -131,9 +131,9 @@ if ($agentid > 0) { $sql .= " AND sc.fk_user = ".$agentid; } if (!empty($startdate)) - $sql.= " AND f.datef >= '".$startdate."'"; + $sql.= " AND f.datef >= '".$db->idate($startdate)."'"; if (!empty($enddate)) - $sql.= " AND f.datef <= '".$enddate."'"; + $sql.= " AND f.datef <= '".$db->idate($enddate)."'"; $sql .= " AND d.buy_price_ht IS NOT NULL"; if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0"; $sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client, u.rowid, u.login, u.lastname, u.firstname"; diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 2f1ca0f953c..eeff645a6d0 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -49,9 +49,9 @@ $pagenext = $page + 1; $startdate=$enddate=''; if (!empty($_POST['startdatemonth'])) - $startdate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear'])); + $startdate = dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']); if (!empty($_POST['enddatemonth'])) - $enddate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear'])); + $enddate = dol_mktime(12, 0, 0, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']); /* * View @@ -119,33 +119,39 @@ if (! $sortfield) } // Start date -print ''.$langs->trans('StartDate').''; +print ''.$langs->trans('StartDate').' ('.$langs->trans("DateValidation").')'; print ''; $form->select_date($startdate,'startdate','','',1,"sel",1,1); print ''; -print ''.$langs->trans('EndDate').''; +print ''.$langs->trans('EndDate').' ('.$langs->trans("DateValidation").')'; print ''; $form->select_date($enddate,'enddate','','',1,"sel",1,1); print ''; print ''; -print ''; +print ''; print ''; +print ""; + +print '
'; + +print ''; + // Total Margin -print ''; // Margin Rate if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { - print ''; } // Mark Rate if (! empty($conf->global->DISPLAY_MARK_RATES)) { - print ''; } @@ -167,11 +173,11 @@ $sql.= " AND f.fk_statut > 0"; $sql.= " AND s.entity = ".$conf->entity; $sql.= " AND d.fk_facture = f.rowid"; if ($client) - $sql.= " AND f.fk_soc = $socid"; + $sql.= " AND f.fk_soc = ".$socid; if (!empty($startdate)) - $sql.= " AND f.datef >= '".$startdate."'"; + $sql.= " AND f.datef >= '".$db->idate($startdate)."'"; if (!empty($enddate)) - $sql.= " AND f.datef <= '".$enddate."'"; + $sql.= " AND f.datef <= '".$db->idate($enddate)."'"; $sql .= " AND d.buy_price_ht IS NOT NULL"; if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0"; @@ -210,7 +216,7 @@ if ($result) $cumul_achat = 0; $cumul_vente = 0; - + $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); if ($num > 0) @@ -284,7 +290,7 @@ if ($result) $markRate = ($cumul_vente != 0)?(100 * $totalMargin / $cumul_vente):''; } - print ''; + print ''; if ($client) print '
'.$langs->trans("TotalMargin").''; +print '
'.$langs->trans("TotalMargin").''; print ''; // set by jquery (see below) print '
'.$langs->trans("MarginRate").''; + print '
'.$langs->trans("MarginRate").''; print ''; // set by jquery (see below) print '
'.$langs->trans("MarkRate").''; + print '
'.$langs->trans("MarkRate").''; print ''; // set by jquery (see below) print '
'; else @@ -316,11 +322,9 @@ $db->close(); diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 6707eb269a7..58ce0e6481f 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -471,11 +471,12 @@ if (! empty($conf->margin->enabled)) } var price = 0; - if (remise.val().replace(',','.') != 100) + remisejs=price2numjs(remise.val()); + + if (remisejs != 100) { bpjs=price2numjs(buying_price.val()); ratejs=price2numjs(rate.val()); - remisejs=price2numjs(remise.val()); if (npRate == "marginRate") price = ((bpjs * (1 + ratejs / 100)) / (1 - remisejs / 100)); diff --git a/htdocs/core/tpl/predefinedproductline_create.tpl.php b/htdocs/core/tpl/predefinedproductline_create.tpl.php index 4816c94e26d..ec430015135 100644 --- a/htdocs/core/tpl/predefinedproductline_create.tpl.php +++ b/htdocs/core/tpl/predefinedproductline_create.tpl.php @@ -270,42 +270,56 @@ if (! empty($usemargins) && $user->rights->margins->creer) return false; } - var np_price = 0; - if (remise.val().replace(',','.') != 100) + var price = 0; + remisejs=price2numjs(remise.val()); + + if (remisejs != 100) { + bpjs=price2numjs(buying_price.val()); + ratejs=price2numjs(rate.val()); + if (npRate == "np_marginRate_predef") - np_price = ((buying_price.val().replace(',','.') * (1 + rate.val().replace(',','.') / 100)) / (1 - remise.val().replace(',','.') / 100)); - else { - if (npRate == "np_markRate_predef") - np_price = ((buying_price.val().replace(',','.') / (1 - rate.val().replace(',','.') / 100)) / (1 - remise.val().replace(',','.') / 100)); - } + price = ((bpjs * (1 + ratejs / 100)) / (1 - remisejs / 100)); + else if (npRate == "np_markRate_predef") + price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100)); } - $("input[name='price_ht_predef']:last").val(roundFloat(np_price)); + $("input[name='price_ht_predef']:last").val(price); // TODO Must use a function like php price to have here a formated value return true; } - // TODO This works for french numbers only - function roundFloat(num) { - var main_max_dec_shown = global->MAIN_MAX_DECIMALS_SHOWN; ?>; - var main_rounding = global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); ?>; + /* Function similar to price2num in PHP */ + function price2numjs(num) + { + transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") $dec=$langs->transnoentitiesnoconv("SeparatorDecimal"); + if ($langs->transnoentitiesnoconv("SeparatorThousand")!= "SeparatorThousand") $thousand=$langs->transnoentitiesnoconv("SeparatorThousand"); + if ($thousand == 'None') $thousand=''; + print "var dec='".$dec."'; var thousand='".$thousand."';\n"; + ?> - var amount = num.toString().replace(',','.'); // should be useless - var nbdec = 0; - var rounding = main_rounding; - var pos = amount.indexOf('.'); + var main_max_dec_shown = global->MAIN_MAX_DECIMALS_SHOWN; ?>; + var main_rounding_unit = global->MAIN_MAX_DECIMALS_UNIT; ?>; + var main_rounding_tot = global->MAIN_MAX_DECIMALS_TOT; ?>; + + var amount = num.toString(); + + // rounding for unit price + var rounding = main_rounding_unit; + var pos = amount.indexOf(dec); var decpart = ''; - if (pos >= 0) - decpart = amount.substr(pos+1).replace('/0+$/i',''); // Supprime les 0 de fin de partie decimale - nbdec = decpart.length; - if (nbdec > rounding) - rounding = nbdec; - // Si on depasse max - if (rounding > main_max_dec_shown) - { - rounding = main_max_dec_shown; - } - //amount = parseFloat(amount) + (1 / Math.pow(100, rounding)); // to avoid floating-point errors + if (pos >= 0) decpart = amount.substr(pos+1).replace('/0+$/i',''); // Supprime les 0 de fin de partie decimale + var nbdec = decpart.length; + 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 parseFloat(amount).toFixed(rounding); }