From 05ed96f7fa52c5be4550393b725164ac70b11285 Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Tue, 2 Sep 2014 10:45:53 +0200 Subject: [PATCH 01/43] Update modContrat.class.php add export contract/service feature --- htdocs/core/modules/modContrat.class.php | 48 ++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/htdocs/core/modules/modContrat.class.php b/htdocs/core/modules/modContrat.class.php index 2ffc46b60bb..e77067fc25e 100644 --- a/htdocs/core/modules/modContrat.class.php +++ b/htdocs/core/modules/modContrat.class.php @@ -114,6 +114,54 @@ class modContrat extends DolibarrModules $this->rights[5][3] = 0; $this->rights[5][4] = 'supprimer'; + // Exports + //-------- + $r=1; + + $this->export_code[$r]=$this->rights_class.'_'.$r; + $this->export_label[$r]='ContractAndServices'; // Translation key (used only if key ExportDataset_xxx_z not found) + $this->export_icon[$r]='contract'; + $this->export_permission[$r]=array(array("contrat","export")); + $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','c.code'=>'CountryCode', + 's.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode', + 's.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra', + 'co.rowid'=>"contractId",'co.ref'=>"contactRef",'co.datec'=>"contractDateCreation",'co.date_contrat'=>"DateContract",'co.mise_en_service'=>"DateMiseService", + 'co.fin_validite'=>"EndValidity",'co.date_cloture'=>"Cloture",'co.fk_statut'=>'ContractStatus','co.note'=>"NotePrivate",'co.note_public'=>"NotePublic", + 'cod.rowid'=>'LineId','cod.label'=>"LineLabel",'cod.description'=>"LineDescription",'cod.price_ht'=>"LineUnitPrice",'cod.tva_tx'=>"LineVATRate", + 'cod.qty'=>"LineQty",'cod.total_ht'=>"LineTotalHT",'cod.total_tva'=>"LineTotalVAT",'cod.total_ttc'=>"LineTotalTTC", + 'cod.date_ouverture'=>"DateStart",'cod.date_ouverture_prevue'=>"DateStartPrevis",'cod.date_fin_validite'=>"EndValidity",'cod.date_cloture'=>"DateEnd", + 'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); + + $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company', + 's.ville'=>'company','c.code'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company', + 's.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company', + 'co.rowid'=>"Contract",'co.ref'=>"Contract",'co.datec'=>"Contract",'co.date_contrat'=>"Contract",'co.mise_en_service'=>"Contract", + 'co.fin_validite'=>"Contract",'co.date_cloture'=>"Contract",'co.fk_statut'=>'Contract','co.note'=>"Contract",'co.note_public'=>"Contract", + 'cod.rowid'=>'contract_line','cod.label'=>"contract_line",'cod.description'=>"contract_line",'cod.price_ht'=>"contract_line",'cod.tva_tx'=>"contract_line", + 'cod.qty'=>"contract_line",'cod.total_ht'=>"contract_line",'cod.total_tva'=>"contract_line",'cod.total_ttc'=>"contract_line", + 'cod.date_ouverture'=>"contract_line",'cod.date_ouverture_prevue'=>"contract_line",'cod.date_fin_validite'=>"contract_line",'cod.date_cloture'=>"contract_line", + 'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product'); + + $this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','c.code'=>'Text', + 's.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text', + 's.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text', + 'co.ref'=>"Text",'co.datec'=>"Date",'co.date_contrat'=>"Date",'co.mise_en_service'=>"Date", + 'co.fin_validite'=>"Date",'co.date_cloture'=>"Date",'co.fk_statut'=>'Statut','co.note'=>"Text",'co.note_public'=>"Text", + 'cod.label'=>"Text",'cod.description'=>"Text",'cod.price_ht'=>"Numeric",'cod.tva_tx'=>"Numeric", + 'cod.qty'=>"Numeric",'cod.total_ht'=>"Numeric",'cod.total_tva'=>"Numeric",'cod.total_ttc'=>"Numeric", + 'cod.date_ouverture'=>"Date",'cod.date_ouverture_prevue'=>"Date",'cod.date_fin_validite'=>"Date",'cod.date_cloture'=>"Date", + 'p.rowid'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text'); + + + $this->export_sql_start[$r]='SELECT DISTINCT '; + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_pays as c on s.fk_pays = c.rowid,'; + $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'contrat as co,'; + $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'contratdet as cod'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (cod.fk_product = p.rowid)'; + $this->export_sql_end[$r] .=' WHERE co.fk_soc = s.rowid and co.rowid = cod.fk_contrat'; + $this->export_sql_end[$r] .=' AND co.entity = '.$conf->entity; + } From 287e2ca032034586a97257a4c6b192c11bfd7a95 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 15 Sep 2014 09:58:44 +0200 Subject: [PATCH 02/43] Add ref_ext into fetch product (else fetch and update set this column to null) --- htdocs/product/class/product.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index c3b337c4a16..fa241367462 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1351,6 +1351,7 @@ class Product extends CommonObject $sql.= " weight, weight_units, length, length_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,"; $sql.= " accountancy_code_buy, accountancy_code_sell, stock, pmp,"; $sql.= " datec, tms, import_key, entity, desiredstock, tobatch"; + $sql.= " ,ref_ext"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; if ($id) $sql.= " WHERE rowid = ".$this->db->escape($id); else @@ -1424,6 +1425,8 @@ class Product extends CommonObject $this->date_modification = $obj->tms; $this->import_key = $obj->import_key; $this->entity = $obj->entity; + + $this->ref_ext = $obj->ref_ext; $this->db->free($resql); From 248ef4fd46f0ae2250230329272581177d96190e Mon Sep 17 00:00:00 2001 From: Eden Date: Fri, 19 Sep 2014 20:36:02 +0200 Subject: [PATCH 03/43] Fix: gidNumber ldap attribute was not defined i using posixGroup objectClass --- htdocs/admin/ldap_groups.php | 4 ++++ htdocs/user/group/ldap.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/htdocs/admin/ldap_groups.php b/htdocs/admin/ldap_groups.php index e043bff88aa..a0bb5c4b605 100644 --- a/htdocs/admin/ldap_groups.php +++ b/htdocs/admin/ldap_groups.php @@ -219,6 +219,10 @@ if (function_exists("ldap_connect")) $info=$object->_load_ldap_info(); $dn=$object->_load_ldap_dn($info); + // Get a gid number for objectclass PosixGroup + if(in_array('posixGroup',$info['objectclass'])) + $info['gidNumber'] = $ldap->getNextGroupGid(); + $result1=$ldap->delete($dn); // To be sure to delete existing records $result2=$ldap->add($dn,$info,$user); // Now the test $result3=$ldap->delete($dn); // Clean what we did diff --git a/htdocs/user/group/ldap.php b/htdocs/user/group/ldap.php index cde5e764af5..978b1929b98 100644 --- a/htdocs/user/group/ldap.php +++ b/htdocs/user/group/ldap.php @@ -64,6 +64,10 @@ if ($action == 'dolibarr2ldap') $result=$ldap->connect_bind(); $info=$fgroup->_load_ldap_info(); + // Get a gid number for objectclass PosixGroup + if(in_array('posixGroup',$info['objectclass'])) + $info['gidNumber'] = $ldap->getNextGroupGid(); + $dn=$fgroup->_load_ldap_dn($info); $olddn=$dn; // We can say that old dn = dn as we force synchro From 860253759b50bf864d253bb767003c5c17f5fd97 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 23 Sep 2014 11:59:57 +0200 Subject: [PATCH 04/43] Add hook for addMorButton into supplier card --- htdocs/fourn/fiche.php | 65 +++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 26 deletions(-) diff --git a/htdocs/fourn/fiche.php b/htdocs/fourn/fiche.php index 127dcfdcc8c..2719f9e0a9b 100644 --- a/htdocs/fourn/fiche.php +++ b/htdocs/fourn/fiche.php @@ -48,6 +48,12 @@ $result = restrictedArea($user, 'societe&fournisseur', $id, '&societe'); $object = new Fournisseur($db); +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('suppliercard')); + +$parameters = array('id' => $id); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks + /* * Action */ @@ -435,34 +441,41 @@ if ($object->fetch($id)) * Barre d'actions */ + print '
'; - - if ($user->rights->fournisseur->commande->creer) - { - $langs->load("orders"); - print ''.$langs->trans("AddOrder").''; + + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been + // modified by hook + if (empty($reshook)) { + + if ($user->rights->fournisseur->commande->creer) + { + $langs->load("orders"); + print ''.$langs->trans("AddOrder").''; + } + + if ($user->rights->fournisseur->facture->creer) + { + $langs->load("bills"); + print ''.$langs->trans("AddBill").''; + } + + // Add action + if (! empty($conf->agenda->enabled) && ! empty($conf->global->MAIN_REPEATTASKONEACHTAB)) + { + if ($user->rights->agenda->myactions->create) + { + print ''.$langs->trans("AddAction").''; + } + else + { + print ''.$langs->trans("AddAction").''; + } + } + + print '
'; } - - if ($user->rights->fournisseur->facture->creer) - { - $langs->load("bills"); - print ''.$langs->trans("AddBill").''; - } - - // Add action - if (! empty($conf->agenda->enabled) && ! empty($conf->global->MAIN_REPEATTASKONEACHTAB)) - { - if ($user->rights->agenda->myactions->create) - { - print ''.$langs->trans("AddAction").''; - } - else - { - print ''.$langs->trans("AddAction").''; - } - } - - print ''; print '
'; if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB)) From d1868b643ea842200237bb7f9a84e200fe4344ed Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 24 Sep 2014 11:47:34 +0200 Subject: [PATCH 05/43] FIX: clone line extrafields value on quote, order and invoice --- htdocs/comm/propal/class/propal.class.php | 11 +++++++++-- htdocs/commande/class/commande.class.php | 9 +++++++-- htdocs/compta/facture/class/facture.class.php | 9 +++++++-- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 1c2fe54cc71..2c507e3e59d 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -8,7 +8,7 @@ * Copyright (C) 2008 Raphael Bertrand * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2010-2011 Philippe Grand - * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2013 Florian Henry * * This program is free software; you can redistribute it and/or modify @@ -788,6 +788,9 @@ class Propal extends CommonObject $this->lines[$i]->fk_fournprice, $this->lines[$i]->pa_ht, $this->lines[$i]->label + $this->lines[$i]->date_start, + $this->lines[$i]->date_end, + $this->lines[$i]->array_options ); if ($result < 0) @@ -922,6 +925,10 @@ class Propal extends CommonObject $this->db->begin(); + // get extrafields so they will be clone + foreach($this->lines as $line) + $line->fetch_optionals($line->rowid); + // Load source object $objFrom = dol_clone($this); @@ -1046,7 +1053,7 @@ class Propal extends CommonObject $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON p.fk_input_reason = dr.rowid'; $sql.= " WHERE p.fk_statut = c.id"; $sql.= " AND p.entity = ".$conf->entity; - if ($ref) $sql.= " AND p.ref='".$this->db->escape($ref)."'"; + if ($ref) $sql.= " AND p.ref='".$ref."'"; else $sql.= " AND p.rowid=".$rowid; dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 795c2e26526..7a8fd63c8f1 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2011 Jean Heimburger - * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2013 Florian Henry * * This program is free software; you can redistribute it and/or modify @@ -712,7 +712,8 @@ class Commande extends CommonOrder $fk_parent_line, $this->lines[$i]->fk_fournprice, $this->lines[$i]->pa_ht, - $this->lines[$i]->label + $this->lines[$i]->label, + $this->lines[$i]->array_options ); if ($result < 0) { @@ -850,6 +851,10 @@ class Commande extends CommonOrder $this->db->begin(); + // get extrafields so they will be clone + foreach($this->lines as $line) + $line->fetch_optionals($line->rowid); + // Load source object $objFrom = dol_clone($this); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index e9bf109b9e7..93e245746a0 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -8,7 +8,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2010-2013 Juanjo Menent - * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2012 Marcos García * Copyright (C) 2013 Cedric Gross * Copyright (C) 2013 Florian Henry @@ -367,7 +367,8 @@ class Facture extends CommonInvoice $fk_parent_line, $this->lines[$i]->fk_fournprice, $this->lines[$i]->pa_ht, - $this->lines[$i]->label + $this->lines[$i]->label, + $this->lines[$i]->array_options ); if ($result < 0) { @@ -569,6 +570,10 @@ class Facture extends CommonInvoice $this->db->begin(); + // get extrafields so they will be clone + foreach($this->lines as $line) + $line->fetch_optionals($line->rowid); + // Load source object $objFrom = dol_clone($this); From 2c52de3840c520965839d43a8307074255b23304 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 24 Sep 2014 12:12:10 +0200 Subject: [PATCH 06/43] fix missing "," --- htdocs/comm/propal/class/propal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 2c507e3e59d..507a9dce633 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -787,7 +787,7 @@ class Propal extends CommonObject $fk_parent_line, $this->lines[$i]->fk_fournprice, $this->lines[$i]->pa_ht, - $this->lines[$i]->label + $this->lines[$i]->label, $this->lines[$i]->date_start, $this->lines[$i]->date_end, $this->lines[$i]->array_options From 7b9f154c295eb10c02e9d79bd526ff99ef6f04fc Mon Sep 17 00:00:00 2001 From: fmarcet Date: Thu, 25 Sep 2014 12:45:08 +0200 Subject: [PATCH 07/43] Fix: Withdrawal total amount is double --- ChangeLog | 1 + htdocs/compta/prelevement/class/bonprelevement.class.php | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 079219e6c7f..57e1876b760 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,7 @@ For users: - Fix: Extrafield feature select from table should try to translate multiple column when not needed - Fix: cents for indian ruppes are calle paisa and paise. - Fix: Invoices payments may be older than invoices. +- Fix: Withdrawal total amount is double - Fix: [ bug #1593 ] Spanish Localtax IRPF not being calculated since 3.6.0 in supplier invoices when adding a line ***** ChangeLog for 3.6 compared to 3.5.* ***** diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 104277f4ed5..4bc91e4a5bc 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2010-2014 Laurent Destailleur + * Copyright (C) 2014 Ferran Marcet * * 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 @@ -1411,7 +1412,7 @@ class BonPrelevement extends CommonObject fputs($this->file, ' '.$CrLf); fputs($this->file, ''.$CrLf); - $sql = "SELECT pl.amount"; + /*$sql = "SELECT pl.amount"; $sql.= " FROM"; $sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; $sql.= " ".MAIN_DB_PREFIX."facture as f,"; @@ -1437,7 +1438,7 @@ class BonPrelevement extends CommonObject else { $result = -2; - } + }*/ } From 96c5771718ec4ca070d948c5b4161eb361dd1484 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 26 Sep 2014 16:18:32 +0200 Subject: [PATCH 08/43] Fix web service category --- ChangeLog | 1 + htdocs/webservices/server_category.php | 81 +++++++++++--------------- 2 files changed, 34 insertions(+), 48 deletions(-) diff --git a/ChangeLog b/ChangeLog index 079219e6c7f..d422594ef83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,7 @@ For users: - Fix: cents for indian ruppes are calle paisa and paise. - Fix: Invoices payments may be older than invoices. - Fix: [ bug #1593 ] Spanish Localtax IRPF not being calculated since 3.6.0 in supplier invoices when adding a line +- Fix: Web service categorie WDSL declaration is correct ***** ChangeLog for 3.6 compared to 3.5.* ***** For users: diff --git a/htdocs/webservices/server_category.php b/htdocs/webservices/server_category.php index 1b85c677175..45a8fb76a78 100644 --- a/htdocs/webservices/server_category.php +++ b/htdocs/webservices/server_category.php @@ -106,56 +106,41 @@ $server->wsdl->addComplexType( 'tns:categorie' ); -/* - * Tableau des catégories - -$server->wsdl->addComplexType( - 'categories', - 'complexType', - 'array', - '', - 'SOAP-ENC:Array', - array(), - array( - array('id'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:categorie[]') - ), - 'tns:categories' -); + /* + * Image of product */ - -/* - * Les photos de la catégorie (un tableau indéxé qui contient les images avec leur vignette) + $server->wsdl->addComplexType( + 'PhotosArray', + 'complexType', + 'array', + 'sequence', + '', + array( + 'image' => array( + 'name' => 'image', + 'type' => 'tns:image', + 'minOccurs' => '0', + 'maxOccurs' => 'unbounded' + ) + ) + ); + + /* + * An image */ -$server->wsdl->addComplexType( - 'PhotosArray', - 'complexType', - 'array', - '', - 'SOAP-ENC:Array', - array(), - array( - array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:image[]') - ), - '' -); - -/* - * Une photo ( nom image / nom_vignette ) - */ -$server->wsdl->addComplexType( - 'image', - 'complexType', - 'array', - '', - 'SOAP-ENC:Array', - array(), - array( - 'photo' => array('name'=>'photo','type'=>'xsd:string'), - 'photo_vignette' => array('name'=>'photo_vignette','type'=>'xsd:string'), - 'imgWidth' => array('name'=>'imgWidth','type'=>'xsd:string'), - 'imgHeight' => array('name'=>'imgHeight','type'=>'xsd:string') - ) -); + $server->wsdl->addComplexType( + 'image', + 'complexType', + 'struct', + 'all', + '', + array( + 'photo' => array('name'=>'photo','type'=>'xsd:string'), + 'photo_vignette' => array('name'=>'photo_vignette','type'=>'xsd:string'), + 'imgWidth' => array('name'=>'imgWidth','type'=>'xsd:string'), + 'imgHeight' => array('name'=>'imgHeight','type'=>'xsd:string') + ) + ); /* * Retour From 6a570222cc413ffe305f32b08939e63f5e7c814a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Sep 2014 14:18:04 +0200 Subject: [PATCH 09/43] Fix: Missing fields into select --- htdocs/comm/action/class/actioncomm.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 9919dc21e80..360f38c3f45 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -284,7 +284,7 @@ class ActionComm extends CommonObject $sql.= " a.fk_user_action, a.fk_user_done,"; $sql.= " a.fk_contact, a.percent as percentage,"; $sql.= " a.fk_element, a.elementtype,"; - $sql.= " a.priority, a.fulldayevent, a.location, a.transparency,"; + $sql.= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,"; $sql.= " c.id as type_id, c.code as type_code, c.libelle,"; $sql.= " s.nom as socname,"; $sql.= " u.firstname, u.lastname as lastname"; @@ -878,7 +878,7 @@ class ActionComm extends CommonObject $sql.= " a.fk_user_action, a.fk_user_done,"; $sql.= " a.fk_contact, a.percent as percentage,"; $sql.= " a.fk_element, a.elementtype,"; - $sql.= " a.priority, a.fulldayevent, a.location,"; + $sql.= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,"; $sql.= " u.firstname, u.lastname,"; $sql.= " s.nom as socname,"; $sql.= " c.id as type_id, c.code as type_code, c.libelle"; From 8c6ce79d9d0da035f67d0e67a0db34ec7c9cb8a7 Mon Sep 17 00:00:00 2001 From: Drosis Nikos Date: Mon, 29 Sep 2014 18:15:09 +0300 Subject: [PATCH 10/43] Fix Lang for Payment Type --- htdocs/compta/sociales/charges.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/sociales/charges.php b/htdocs/compta/sociales/charges.php index 48a8f656959..4ea2af2c20f 100644 --- a/htdocs/compta/sociales/charges.php +++ b/htdocs/compta/sociales/charges.php @@ -300,7 +300,7 @@ if ($id > 0) * Payments */ $sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,"; - $sql.= "c.libelle as paiement_type"; + $sql.= "c.code as type_code,c.libelle as paiement_type"; $sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p"; $sql.= ", ".MAIN_DB_PREFIX."c_paiement as c "; $sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs"; @@ -333,8 +333,9 @@ if ($id > 0) print ""; print ''.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.''; print ''.dol_print_date($db->jdate($objp->dp),'day')."\n"; - print "".$objp->paiement_type.' '.$objp->num_paiement."\n"; - print ''.price($objp->amount)." ".$langs->trans("Currency".$conf->currency)."\n"; + $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type; + print "".$labeltype.' '.$objp->num_paiement."\n"; + print ''.price($objp->amount)." ".$langs->trans("Currency".$conf->currency)."\n"; print ""; $totalpaye += $objp->amount; $i++; From 920c9c725104b58ca3375ff7bf436042aa04f976 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 30 Sep 2014 17:36:01 +0200 Subject: [PATCH 11/43] Fix : tva not coming from multiprice --- htdocs/comm/propal.php | 2 -- htdocs/commande/fiche.php | 2 -- htdocs/compta/facture.php | 2 -- 3 files changed, 6 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index cece1b3b29e..beaa24be32e 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -738,8 +738,6 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- $pu_ttc = $prod->multiprices_ttc[$object->client->price_level]; $price_min = $prod->multiprices_min[$object->client->price_level]; $price_base_type = $prod->multiprices_base_type[$object->client->price_level]; - $tva_tx=$prod->multiprices_tva_tx[$object->client->price_level]; - $tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level]; } else { diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 99864a59dd2..9af80af21e1 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -686,8 +686,6 @@ else if ($action == 'addline' && $user->rights->commande->creer) $pu_ttc = $prod->multiprices_ttc[$object->client->price_level]; $price_min = $prod->multiprices_min[$object->client->price_level]; $price_base_type = $prod->multiprices_base_type[$object->client->price_level]; - $tva_tx=$prod->multiprices_tva_tx[$object->client->price_level]; - $tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level]; } else { diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index b17b59cf704..11a920877cd 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1262,8 +1262,6 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- $pu_ttc = $prod->multiprices_ttc[$object->client->price_level]; $price_min = $prod->multiprices_min[$object->client->price_level]; $price_base_type = $prod->multiprices_base_type[$object->client->price_level]; - //$tva_tx=$prod->multiprices_tva_tx[$object->client->price_level]; - //$tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level]; } else { From 769d824e7b043c237bb3ebba4fcd01b508f5f255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Mon, 29 Sep 2014 16:25:18 +0200 Subject: [PATCH 12/43] Allow reporting progress along with timespent --- htdocs/core/lib/project.lib.php | 10 +++++++--- htdocs/projet/activity/list.php | 1 + htdocs/projet/class/task.class.php | 1 + htdocs/projet/index.php | 2 +- htdocs/projet/tasks/time.php | 10 +++++++++- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index e9ceb297680..d8ecc52f6d9 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -445,7 +445,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t * * @param string $inc ? * @param string $parent ? - * @param Object $lines ? + * @param Task[] $lines ? * @param int $level ? * @param string $projectsrole ? * @param string $tasksrole ? @@ -455,9 +455,13 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t */ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=0) { - global $user, $bc, $langs; + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; + + global $db, $user, $bc, $langs; global $form, $projectstatic, $taskstatic; + $formother = new FormOther($db); + $lastprojectid=0; $var=true; @@ -526,7 +530,7 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr // Progress declared % print ''; - print $lines[$i]->progress.' %'; + print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress'); print ''; // Time spent diff --git a/htdocs/projet/activity/list.php b/htdocs/projet/activity/list.php index 9a1142fe5c0..e83fe30e865 100644 --- a/htdocs/projet/activity/list.php +++ b/htdocs/projet/activity/list.php @@ -83,6 +83,7 @@ if ($action == 'addtime' && $user->rights->projet->creer) foreach($timespent_duration as $key => $val) { $task->fetch($key); + $task->progress = GETPOST($key . 'progress', 'int'); $task->timespent_duration = $val; $task->timespent_fk_user = $user->id; $task->timespent_date = dol_mktime(12,0,0,$_POST["{$key}month"],$_POST["{$key}day"],$_POST["{$key}year"]); diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 13360110310..4788188aab3 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -785,6 +785,7 @@ class Task extends CommonObject { $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task"; $sql.= " SET duration_effective = duration_effective + '".price2num($this->timespent_duration)."'"; + $sql.= ", progress = " . $this->progress; $sql.= " WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::addTimeSpent", LOG_DEBUG); diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 7e324841af2..766e954e2eb 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -166,7 +166,7 @@ $sql.= " WHERE p.entity = ".$conf->entity; if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; $sql.= " AND p.fk_statut=1"; -$sql.= " GROUP BY p.title, p.rowid, t.label, t.rowid, u.rowid, t.planned_workload, t.dateo, t.datee"; +$sql.= " GROUP BY p.ref, p.title, p.rowid, t.label, t.rowid, u.rowid, t.planned_workload, t.dateo, t.datee"; $sql.= " ORDER BY u.rowid, t.dateo, t.datee"; $userstatic=new User($db); diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 5c790df32f0..eff94d532e5 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; $langs->load('projects'); @@ -83,11 +84,11 @@ if ($action == 'addtimespent' && $user->rights->projet->creer) else { $object->timespent_note = $_POST["timespent_note"]; + $object->progress = GETPOST('progress', 'int'); $object->timespent_duration = $_POST["timespent_durationhour"]*60*60; // We store duration in seconds $object->timespent_duration+= $_POST["timespent_durationmin"]*60; // We store duration in seconds $object->timespent_date = dol_mktime(12,0,0,$_POST["timemonth"],$_POST["timeday"],$_POST["timeyear"]); $object->timespent_fk_user = $_POST["userid"]; - $result=$object->addTimeSpent($user); if ($result >= 0) { @@ -185,6 +186,7 @@ if (! empty($project_ref) && ! empty($withproject)) llxHeader("",$langs->trans("Task")); $form = new Form($db); +$formother = new FormOther($db); $userstatic = new User($db); if ($id > 0 || ! empty($ref)) @@ -331,6 +333,7 @@ if ($id > 0 || ! empty($ref)) print ''.$langs->trans("Date").''; print ''.$langs->trans("By").''; print ''.$langs->trans("Note").''; + print ''.$langs->trans("Progress").''; print ''.$langs->trans("Duration").''; print ' '; print "\n"; @@ -360,6 +363,11 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; + // Progress + print ''; + print $formother->select_percent($object->progress,'progress'); + print ''; + // Duration print ''; print $form->select_duration('timespent_duration',($_POST['timespent_duration']?$_POST['timespent_duration']:''),0,'text'); From 78ec4d595b11c22317c54074d0b61a998b3b18cb Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 2 Oct 2014 15:21:49 +0200 Subject: [PATCH 13/43] Fix trad currency --- ChangeLog | 1 + htdocs/product/composition/fiche.php | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 34448e95543..218d6aada55 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,7 @@ For users: - Fix: Withdrawal total amount is double - Fix: [ bug #1593 ] Spanish Localtax IRPF not being calculated since 3.6.0 in supplier invoices when adding a line - Fix: Web service categorie WDSL declaration is correct +- Fix: ErrorBadValueForParamNotAString was displayed in virtual product if no base price defined ***** ChangeLog for 3.6 compared to 3.5.* ***** For users: diff --git a/htdocs/product/composition/fiche.php b/htdocs/product/composition/fiche.php index 26761a2d56b..bf89798e79f 100644 --- a/htdocs/product/composition/fiche.php +++ b/htdocs/product/composition/fiche.php @@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $langs->load("bills"); $langs->load("products"); +$langs->load("main"); $id=GETPOST('id','int'); $ref=GETPOST('ref','alpha'); @@ -292,13 +293,17 @@ if ($id > 0 || ! empty($ref)) { // Price print ''.$langs->trans("SellingPrice").''; + if ($object->price_base_type == 'TTC') { print price($object->price_ttc).' '.$langs->trans($object->price_base_type); } else { - print price($object->price).' '.$langs->trans($object->price_base_type); + print price($object->price); + if (!empty($object->price_base_type)) { + print ' '.$langs->trans($object->price_base_type); + } } print ''; @@ -310,7 +315,10 @@ if ($id > 0 || ! empty($ref)) } else { - print price($object->price_min).' '.$langs->trans($object->price_base_type); + print price($object->price_min); + if (!empty($object->price_base_type)) { + print ' '.$langs->trans($object->price_base_type); + } } print ''; } From 4b28ff005ef29c8de594eca9b24c2ab8a54356ea Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 2 Oct 2014 15:24:40 +0200 Subject: [PATCH 14/43] Return error message on category creation failure --- ChangeLog | 1 + htdocs/categories/fiche.php | 2 ++ 2 files changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index 218d6aada55..fc92cfd43a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,7 @@ For users: - Fix: [ bug #1593 ] Spanish Localtax IRPF not being calculated since 3.6.0 in supplier invoices when adding a line - Fix: Web service categorie WDSL declaration is correct - Fix: ErrorBadValueForParamNotAString was displayed in virtual product if no base price defined +- Fix: Category creation failed and no message output ***** ChangeLog for 3.6 compared to 3.5.* ***** For users: diff --git a/htdocs/categories/fiche.php b/htdocs/categories/fiche.php index a2f9dc54df2..208cbb38331 100644 --- a/htdocs/categories/fiche.php +++ b/htdocs/categories/fiche.php @@ -143,6 +143,8 @@ if ($action == 'add' && $user->rights->categorie->creer) { $action = 'confirmed'; $_POST["addcat"] = ''; + } else { + setEventMessage($object->error,'errors'); } } } From c69565fd69f826f3fc3c846a849f8e088828f4a1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Oct 2014 03:12:39 +0200 Subject: [PATCH 15/43] Fix: column name should not be an numeric --- htdocs/core/actions_extrafields.inc.php | 18 +++++++++--------- htdocs/core/class/commonobject.class.php | 8 ++++---- htdocs/core/class/extrafields.class.php | 5 ++--- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php index 55a538a2195..89edfcbae8e 100644 --- a/htdocs/core/actions_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -28,7 +28,7 @@ $extrasize=GETPOST('size'); if (GETPOST('type')=='double' && strpos($extrasize,',')===false) $extrasize='24,8'; if (GETPOST('type')=='date') $extrasize=''; if (GETPOST('type')=='datetime') $extrasize=''; -if (GETPOST('type')=='select') $extrasize=''; +if (GETPOST('type')=='select') $extrasize=''; // Add attribute @@ -87,7 +87,7 @@ if ($action == 'add') $mesg[]=$langs->trans("ErrorNoValueForRadioType"); $action = 'create'; } - if (((GETPOST('type')=='radio') || (GETPOST('type')=='checkbox')) && GETPOST('param')) + if (((GETPOST('type')=='radio') || (GETPOST('type')=='checkbox')) && GETPOST('param')) { // Construct array for parameter (value of select list) $parameters = GETPOST('param'); @@ -95,7 +95,7 @@ if ($action == 'add') foreach($parameters_array as $param_ligne) { if (!empty($param_ligne)) { - if (preg_match_all('/,/',$param_ligne,$matches)) + if (preg_match_all('/,/',$param_ligne,$matches)) { if (count($matches[0])>1) { $error++; @@ -104,7 +104,7 @@ if ($action == 'add') $action = 'create'; } } - else + else { $error++; $langs->load("errors"); @@ -112,12 +112,12 @@ if ($action == 'add') $action = 'create'; } } - } + } } if (! $error) { - // attrname must be alphabetical and lower case only + // attrname must be alphabetical and lower case only if (isset($_POST["attrname"]) && preg_match("/^[a-z0-9-_]+$/",$_POST['attrname'])) { // Construct array for parameter (value of select list) @@ -139,8 +139,8 @@ if ($action == 'add') list($key,$value) = explode(',',$param_ligne); $params['options'][$key] = $value; } - } - + } + $result=$extrafields->addExtraField($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['pos'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$default_value,$params); if ($result > 0) { @@ -164,7 +164,7 @@ if ($action == 'add') $action = 'create'; } } - else + else { setEventMessage($mesg,'errors'); } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 36b4af841a8..0f41eefddf7 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2120,11 +2120,11 @@ abstract class CommonObject foreach ($tab as $key => $value) { - // Test fetch_array ! is_int($key) because fetch_array seult is a mix table with Key as alpha and Key as int (depend db engine) - if ($key != 'rowid' && $key != 'tms' && $key != 'fk_member' && ! is_int($key)) + // Test fetch_array ! is_int($key) because fetch_array result is a mix table with some key as alpha and some key as int (depend db engine) + if ($key != 'rowid' && $key != 'tms' && ! is_int($key)) { - // we can add this attribute to adherent object - $this->array_options["options_$key"]=$value; + // we can add this attribute to object properties + $this->array_options["options_".$key]=$value; } } } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 7b1f9d59889..c9e5d937a18 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -154,7 +154,7 @@ class ExtraFields { $table=$elementtype.'_extrafields'; - if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) + if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname) && ! is_numeric($attrname)) { if ($type=='boolean') { $typedb='int'; @@ -226,8 +226,7 @@ class ExtraFields // Clean parameters if (empty($pos)) $pos=0; - - if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) + if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname) && ! is_numeric($attrname)) { if(is_array($param) and count($param) > 0) { From a853aed348f2fcc9c8e0258beec591407f1b4634 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Oct 2014 03:42:11 +0200 Subject: [PATCH 16/43] Fix: Some fields not visibles. Wrong value for calculated time. --- htdocs/projet/class/task.class.php | 2 +- htdocs/projet/tasks/task.php | 9 +++++---- htdocs/projet/tasks/time.php | 31 +++++++++++++++++++++++++----- 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index ea0cce9e121..c97b51e53a4 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -41,7 +41,7 @@ class Task extends CommonObject var $fk_task_parent; var $label; var $description; - var $duration_effective; + var $duration_effective; // total of time spent on this task var $planned_workload; var $date_c; var $date_start; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index dd83cf57d8f..908a9513162 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -348,7 +348,7 @@ if ($id > 0 || ! empty($ref)) print ''; // Progress - print ''.$langs->trans("Progress").''; + print ''.$langs->trans("ProgressDeclared").''; print $formother->select_percent($object->progress,'progress'); print ''; @@ -436,14 +436,15 @@ if ($id > 0 || ! empty($ref)) print convertSecondToTime($object->planned_workload,'allhourmin'); print ''; - // Progress + // Declared progress print ''.$langs->trans("ProgressDeclared").''; print $object->progress.' %'; print ''; - // Progress + // Calculated progress print ''.$langs->trans("ProgressCalculated").''; - print $object->progress.' %'; + if ($object->planned_workload) print round(100 * $object->duration_effective / $object->planned_workload,2).' %'; + else print ''; print ''; // Description diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index cb8a4dd193a..7136ffc43c5 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -50,7 +50,7 @@ $projectstatic = new Project($db); /* * Actions -*/ + */ if ($action == 'addtimespent' && $user->rights->projet->creer) { @@ -171,7 +171,7 @@ if (! empty($project_ref) && ! empty($withproject)) /* * View -*/ + */ llxHeader("",$langs->trans("Task")); @@ -283,9 +283,6 @@ if ($id > 0 || ! empty($ref)) // Label print ''.$langs->trans("Label").''.$object->label.''; - // Planned workload - print ''.$langs->trans("PlannedWorkload").''.convertSecondToTime($object->planned_workload,'allhourmin').''; - // Project if (empty($withproject)) { @@ -300,6 +297,30 @@ if ($id > 0 || ! empty($ref)) print ''; } + // Date start + print ''.$langs->trans("DateStart").''; + print dol_print_date($object->date_start,'dayhour'); + print ''; + + // Date end + print ''.$langs->trans("DateEnd").''; + print dol_print_date($object->date_end,'dayhour'); + print ''; + + // Planned workload + print ''.$langs->trans("PlannedWorkload").''.convertSecondToTime($object->planned_workload,'allhourmin').''; + + // Declared progress + print ''.$langs->trans("ProgressDeclared").''; + print $object->progress.' %'; + print ''; + + // Calculated progress + print ''.$langs->trans("ProgressCalculated").''; + if ($object->planned_workload) print round(100 * $object->duration_effective / $object->planned_workload,2).' %'; + else print ''; + print ''; + print ''; dol_fiche_end(); From b85a8359884e90264b92afc7997e828fcce1ff8c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Oct 2014 19:03:58 +0200 Subject: [PATCH 17/43] Prepare 3.6.1 --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index fc92cfd43a9..294fc64ff5a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,6 +25,8 @@ For users: - Fix: Web service categorie WDSL declaration is correct - Fix: ErrorBadValueForParamNotAString was displayed in virtual product if no base price defined - Fix: Category creation failed and no message output +- Fix: Lanf for Payment Type +- Fix: PHPCheckstyle 1.5.5 ***** ChangeLog for 3.6 compared to 3.5.* ***** For users: From 05fe8e45b3ead4dd32b75e2c280b8be4c21356ea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Oct 2014 19:07:49 +0200 Subject: [PATCH 18/43] Exclude module dire from package --- build/makepack-dolibarr.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 55de5abffb4..a1e08361d36 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -434,6 +434,7 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nltechno*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/pos*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/teclib*`; $ret=`rm -fr $BUILDROOT/$PROJECT/test`; $ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`; $ret=`rm -f $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`; From 742d0e37eeadf40c7b01475f5a90b2986777b2d0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 5 Oct 2014 12:54:51 +0200 Subject: [PATCH 19/43] Fix: Bad month return by function --- htdocs/core/lib/date.lib.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 78551dac105..39d3e6ffa7b 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -518,8 +518,8 @@ function dol_get_last_day($year,$month=12,$gm=false) * @param int $day Day * @param int $month Month * @param int $year Year - * @param int $gm False = Return date to compare with server TZ, True to compare with GM date. - * @return array year,month, week,first_day,prev_year,prev_month,prev_day + * @param int $gm False or 0 or 'server' = Return date to compare with server TZ, True or 1 to compare with GM date. + * @return array year,month,week,first_day,prev_year,prev_month,prev_day */ function dol_get_first_day_week($day,$month,$year,$gm=false) { @@ -542,7 +542,7 @@ function dol_get_first_day_week($day,$month,$year,$gm=false) $tmpday = date($tmparray[0])-$seconds; $tmpday = date("d",$tmpday); - //Check first day of week is form this month or not + //Check first day of week is in same month than current day or not if ($tmpday>$day) { $prev_month = $month-1; @@ -559,15 +559,17 @@ function dol_get_first_day_week($day,$month,$year,$gm=false) $prev_month = $month; $prev_year = $year; } + $tmpmonth = $prev_month; + $tmpyear = $prev_year; - //Get first day of next week + //Get first day of next week $tmptime=dol_mktime(12,0,0,$month,$tmpday,$year,1,0); $tmptime-=24*60*60*7; $tmparray=dol_getdate($tmptime,true); $prev_day = $tmparray['mday']; - //Check first day of week is form this month or not - if ($prev_day>$tmpday) + //Check prev day of week is in same month than first day or not + if ($prev_day > $tmpday) { $prev_month = $month-1; $prev_year = $year; @@ -579,9 +581,9 @@ function dol_get_first_day_week($day,$month,$year,$gm=false) } } - $week = date("W",dol_mktime(0,0,0,$month,$tmpday,$year,$gm)); + $week = date("W",dol_mktime(0,0,0,$tmpmonth,$tmpday,$tmpyear,$gm)); - return array('year' => $year, 'month' => $month, 'week' => $week, 'first_day' => $tmpday, 'prev_year' => $prev_year, 'prev_month' => $prev_month, 'prev_day' => $prev_day); + return array('year' => $year, 'month' => $month, 'week' => $week, 'first_day' => $tmpday, 'first_month' => $tmpmonth, 'first_year' => $tmpyear, 'prev_year' => $prev_year, 'prev_month' => $prev_month, 'prev_day' => $prev_day); } /** From c73f4a14ee9d62e8f6a9d4ab8ef502932ae4f36d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 5 Oct 2014 16:17:09 +0200 Subject: [PATCH 20/43] Fix: Bad days returned by function --- htdocs/comm/action/index.php | 51 ++++++++++++++---------------------- 1 file changed, 20 insertions(+), 31 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index efe47defd92..e518b05ded6 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -184,18 +184,19 @@ if ($action=='show_week') $prev_month = $prev['prev_month']; $prev_day = $prev['prev_day']; $first_day = $prev['first_day']; - + $first_month= $prev['first_month']; + $first_year = $prev['first_year']; $week = $prev['week']; $day = (int) $day; - $next = dol_get_next_week($day, $week, $month, $year); + $next = dol_get_next_week($first_day, $week, $first_month, $first_year); $next_year = $next['year']; $next_month = $next['month']; $next_day = $next['day']; // Define firstdaytoshow and lastdaytoshow - $firstdaytoshow=dol_mktime(0,0,0,$prev_month,$first_day,$prev_year); - $lastdaytoshow=dol_mktime(0,0,0,$next_month,$next_day,$next_year); + $firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year); + $lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 7, 'd'); $max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year)); @@ -870,39 +871,27 @@ elseif ($action == 'show_week') // View by week } echo " \n"; - // In loops, tmpday contains day nb in current month (can be zero or negative for days of previous month) - //var_dump($eventarray); - //print $tmpday; - echo " \n"; for($iter_day = 0; $iter_day < 7; $iter_day++) { - if(($tmpday <= $max_day_in_month)) - { - // Show days of the current week - $curtime = dol_mktime(0, 0, 0, $month, $tmpday, $year); + // Show days of the current week + $curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd'); + $tmparray = dol_getdate($curtime,'fast'); + $tmpday = $tmparray['mday']; + $tmpmonth = $tmparray['mon']; + $tmpyear = $tmparray['year']; - $style='cal_current_month'; - if ($iter_day == 6) $style.=' cal_other_month_right'; - $today=0; - $todayarray=dol_getdate($now,'fast'); - if ($todayarray['mday']==$tmpday && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1; - if ($today) $style='cal_today'; + $style='cal_current_month'; + if ($iter_day == 6) $style.=' cal_other_month_right'; + $today=0; + $todayarray=dol_getdate($now,'fast'); + if ($todayarray['mday']==$tmpday && $todayarray['mon']==$tmpmonth && $todayarray['year']==$tmpyear) $today=1; + if ($today) $style='cal_today'; - echo ' '; - show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300); - echo " \n"; - } - else - { - $style='cal_current_month'; - if ($iter_day == 6) $style.=' cal_other_month_right'; - echo ' '; - show_day_events($db, $tmpday - $max_day_in_month, $next_month, $next_year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300); - echo "\n"; - } - $tmpday++; + echo ' '; + show_day_events($db, $tmpday, $tmpmonth, $tmpyear, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300); + echo " \n"; } echo " \n"; From 692881bf5998e06b6fd9adf1ecc830c39b1220c7 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 6 Oct 2014 09:06:25 +0200 Subject: [PATCH 21/43] Fix: missing $ismultientitymanaged --- htdocs/contrat/class/contrat.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 073ef7bd0f5..6cf04c10522 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1,12 +1,12 @@ * Copyright (C) 2004-2012 Destailleur Laurent - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2008 Raphael Bertrand * Copyright (C) 2010-2013 Juanjo Menent - * Copyright (C) 2013 Christophe Battarel - * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013 Christophe Battarel + * 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 @@ -41,6 +41,7 @@ class Contrat extends CommonObject public $table_element='contrat'; public $table_element_line='contratdet'; public $fk_element='fk_contrat'; + protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe var $id; var $ref; From 48072c58d796789edbdfca6091c00d0eb7e8b913 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Mon, 6 Oct 2014 10:05:27 +0200 Subject: [PATCH 22/43] Fix bug 1588 : relative discount not working anymore --- htdocs/core/tpl/objectline_create.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 68613492df8..a51a6505416 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -203,7 +203,7 @@ else { "> - remise_client); ?>" name="remise_percent">% + remise_percent); ?>" name="remise_percent">% Date: Mon, 6 Oct 2014 13:28:07 +0200 Subject: [PATCH 23/43] Missing reprogramming task into GUI for cron module. Without this, a new task is never executed (because without datenextrun defined) --- htdocs/cron/card.php | 15 ++++++++++++--- htdocs/cron/list.php | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index 4857523aaf5..dd30e67afab 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -95,9 +95,18 @@ if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->ex } else { - if ($object->lastresult > 0) setEventMessage($langs->trans("JobFinished"),'warnings'); - else setEventMessage($langs->trans("JobFinished"),'mesgs'); - $action=''; + $res = $object->reprogram_jobs($user->login); + if ($res > 0) + { + if ($object->lastresult > 0) setEventMessage($langs->trans("JobFinished"),'warnings'); + else setEventMessage($langs->trans("JobFinished"),'mesgs'); + $action=''; + } + else + { + setEventMessage($object->error,'errors'); + $action=''; + } } } diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 19a0d5cc3b1..28f16c1ad55 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -100,6 +100,21 @@ if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->ex if ($result < 0) { setEventMessage($object->error,'errors'); } + else + { + $res = $object->reprogram_jobs($user->login); + if ($res > 0) + { + if ($object->lastresult > 0) setEventMessage($langs->trans("JobFinished"),'warnings'); + else setEventMessage($langs->trans("JobFinished"),'mesgs'); + $action=''; + } + else + { + setEventMessage($object->error,'errors'); + $action=''; + } + } header("Location: ".DOL_URL_ROOT.'/cron/list.php?status=-1'); // Make a call to avoid to run twice job when using back exit; From 1e6240953e9cb0f0ffedf3883965305c361f3027 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Mon, 6 Oct 2014 14:10:27 +0200 Subject: [PATCH 24/43] Fix increase stock on shipment validation $obj not set. Re-enabled delete button for shipment with batches, was increase issue, not decrease issue. --- htdocs/expedition/card.php | 10 +--------- htdocs/expedition/class/expedition.class.php | 5 ++--- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index c2649e5f8df..14ef8738b73 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1453,7 +1453,6 @@ else if ($id || $ref) // Batch number managment if (! empty($conf->productbatch->enabled)) { if (isset($lines[$i]->detail_batch) ) { - $flagBatch = true; print ''; $detail = ''; foreach ($lines[$i]->detail_batch as $dbatch) { @@ -1543,14 +1542,7 @@ else if ($id || $ref) if ($user->rights->expedition->supprimer) { - if (empty($conf->productbatch->enabled) || (!empty($conf->productbatch->enabled) && !$conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !isset($flagBatch)) - { - print ''.$langs->trans("Delete").''; - } - else - { - print ''.$langs->trans('Delete').''; - } + print ''.$langs->trans("Delete").''; } print ''; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 019ef22f769..898a65a05b8 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -588,10 +588,9 @@ class Expedition extends CommonObject $cpt = $this->db->num_rows($resql); for ($i = 0; $i < $cpt; $i++) { - if($obj->qty <= 0) continue; - - dol_syslog(get_class($this)."::valid movement index ".$i); $obj = $this->db->fetch_object($resql); + if($obj->qty <= 0) continue; + dol_syslog(get_class($this)."::valid movement index ".$i); //var_dump($this->lines[$i]); $mouvS = new MouvementStock($this->db); From e8ac6567b714f155b0628fe43fb7c2068dfbcf36 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 7 Oct 2014 20:50:57 +0200 Subject: [PATCH 25/43] Fix :: Button on/off for account in chart of accounts --- htdocs/accountancy/admin/account.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 0c929ef5de5..317cd12885d 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -65,8 +65,7 @@ if ($action == 'delete') { $accounting = new AccountingAccount($db); if ($action == 'disable') { - $accounting = $accounting->fetch($id); - if (! empty($accounting->id)) { + if ($accounting->fetch($id)) { $result = $accounting->account_desactivate($id); } @@ -75,10 +74,7 @@ if ($action == 'disable') { setEventMessage($accounting->error, 'errors'); } } else if ($action == 'enable') { - - $accounting = $accounting->fetch($id); - - if (! empty($accounting->id)) { + if ($accounting->fetch($id)) { $result = $accounting->account_activate($id); } $action = 'update'; From b8a40a1b327c737cf35b674bc7b1460398afa221 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Wed, 8 Oct 2014 06:24:46 +0200 Subject: [PATCH 26/43] Presentation --- htdocs/accountancy/customer/list.php | 3 +-- htdocs/accountancy/supplier/list.php | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 3af059cad94..3b68bd6b69e 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -227,9 +227,8 @@ if ($result) { $i ++; } - print ' '; - print ''; + print '
'; print ''; } else { print $db->error(); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 4bf603236db..f932fbfc8af 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -208,10 +208,8 @@ if ($result) { $i ++; } - print ' '; - - print ""; - + print ''; + print '
'; print ''; } else { print $db->error(); From 4fd67d725ab2d634dc0a1f66f3a508a158eabbbf Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Mon, 6 Oct 2014 10:05:27 +0200 Subject: [PATCH 27/43] Fix bug 1588 : relative discount not working anymore --- htdocs/core/tpl/objectline_create.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 68613492df8..a51a6505416 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -203,7 +203,7 @@ else { "> - remise_client); ?>" name="remise_percent">% + remise_percent); ?>" name="remise_percent">% Date: Thu, 9 Oct 2014 21:31:35 +0200 Subject: [PATCH 28/43] Update product.class.php Label of product on tooltip is more usefull than the ref who's already on the link --- htdocs/product/class/product.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e78daeba631..b9521d6594b 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2814,8 +2814,8 @@ class Product extends CommonObject if ($maxlength) $newref=dol_trunc($newref,$maxlength,'middle'); if ($withpicto) { - if ($this->type == 0) $result.=($lien.img_object($langs->trans("ShowProduct").' '.$this->ref,'product').$lienfin.' '); - if ($this->type == 1) $result.=($lien.img_object($langs->trans("ShowService").' '.$this->ref,'service').$lienfin.' '); + if ($this->type == 0) $result.=($lien.img_object($langs->trans("ShowProduct").' '.$this->label,'product').$lienfin.' '); + if ($this->type == 1) $result.=($lien.img_object($langs->trans("ShowService").' '.$this->label,'service').$lienfin.' '); } $result.=$lien.$newref.$lienfin; return $result; From 7978b4503dc6f0cd49be59d9b802f7f816c49cfa Mon Sep 17 00:00:00 2001 From: Andrelec1 Date: Fri, 10 Oct 2014 14:57:07 +0200 Subject: [PATCH 29/43] Add function hideMail and use --- htdocs/core/lib/functions.lib.php | 36 +++++++++++++++++++++++++++++++ htdocs/user/passwordforgotten.php | 3 ++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7097bd2abae..931c0b95fdd 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1224,6 +1224,42 @@ function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64,$showinvalid= return $newemail; } +/** + * Returns a hidden email. + * Hide part of email. + * + * @param string $mail Email + * @param string $replace Replacement caractaire ( defaul : *) + * @param int $nbreplace Number of replacement caractaire (default : 8) + * @param int $nbdisplaymail Number of caractaire unchanged (default: 4) + * @param int $nbdisplaydomain Number of caractaire unchanged of domain (default: 3) + * @param bool $displaytld Display tld (default: true) + * @return string Return hiden email or ''; + */ +function dol_hideMail($mail, $replace="*", $nbreplace=8, $nbdisplaymail=4, $nbdisplaydomain=3, $displaytld=true){ + if(!isValidEmail($mail))return ' '; + $tab = explode('@', $mail); + $tab2 = explode('.',$tab[1]); + $string_replace = ''; + $mail_name = $tab[0]; + $mail_domaine = $tab2[0]; + $mail_tld = $displaytld ? ".".$tab2[1] : " "; + + for($i=0; $i < $nbreplace; $i++){ + $string_replace .= $replace; + } + + if(strlen($mail_name) > $nbdisplaymail){ + $mail_name = substr($mail_name, 0, $nbdisplaymail); + } + + if(strlen($mail_domaine) > $nbdisplaydomain){ + $mail_domaine = substr($mail_domaine, strlen($mail_domaine)-$nbdisplaydomain); + } + + return $mail_name . $string_replace . $mail_domaine . $mail_tld; +} + /** * Show Skype link * diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index 4f1a36c6e04..c3c4fccb888 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -130,7 +130,8 @@ if ($action == 'buildnewpassword' && $username) // Success if ($edituser->send_password($user,$newpassword,1) > 0) { - $message = '
'.$langs->trans("PasswordChangeRequestSent",$edituser->login,$edituser->email).'
'; + + $message = '
'.$langs->trans("PasswordChangeRequestSent",$edituser->login,dol_hideMail($edituser->email)).'
'; //$message.=$newpassword; $username=''; } From f4f1f45d5a0da2124662a517666054183b43e242 Mon Sep 17 00:00:00 2001 From: Andrelec1 Date: Fri, 10 Oct 2014 15:01:10 +0200 Subject: [PATCH 30/43] copyright and annotation --- htdocs/core/lib/functions.lib.php | 13 +++++++------ htdocs/user/passwordforgotten.php | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 931c0b95fdd..28695fa41f4 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11,6 +11,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2013 Alexandre Spangaro * Copyright (C) 2014 Marcos García + * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * * 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 @@ -1229,15 +1230,15 @@ function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64,$showinvalid= * Hide part of email. * * @param string $mail Email - * @param string $replace Replacement caractaire ( defaul : *) - * @param int $nbreplace Number of replacement caractaire (default : 8) - * @param int $nbdisplaymail Number of caractaire unchanged (default: 4) - * @param int $nbdisplaydomain Number of caractaire unchanged of domain (default: 3) + * @param string $replace Replacement character ( defaul : *) + * @param int $nbreplace Number of replacement character (default : 8) + * @param int $nbdisplaymail Number of character unchanged (default: 4) + * @param int $nbdisplaydomain Number of character unchanged of domain (default: 3) * @param bool $displaytld Display tld (default: true) - * @return string Return hiden email or ''; + * @return string Return hidden email or ''; */ function dol_hideMail($mail, $replace="*", $nbreplace=8, $nbdisplaymail=4, $nbdisplaydomain=3, $displaytld=true){ - if(!isValidEmail($mail))return ' '; + if(!isValidEmail($mail))return ''; $tab = explode('@', $mail); $tab2 = explode('.',$tab[1]); $string_replace = ''; diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index c3c4fccb888..eccd3d0cda3 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -2,6 +2,7 @@ /* Copyright (C) 2007-2011 Laurent Destailleur * Copyright (C) 2008-2012 Regis Houssin * Copyright (C) 2008-2011 Juanjo Menent + * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * * 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 From 269b960d9a6127380677c27e1f618d369e49f8a9 Mon Sep 17 00:00:00 2001 From: Andrelec1 Date: Fri, 10 Oct 2014 15:18:24 +0200 Subject: [PATCH 31/43] Add support tld with dots --- htdocs/core/lib/functions.lib.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 28695fa41f4..9dd4bb4da6b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1244,7 +1244,11 @@ function dol_hideMail($mail, $replace="*", $nbreplace=8, $nbdisplaymail=4, $nbdi $string_replace = ''; $mail_name = $tab[0]; $mail_domaine = $tab2[0]; - $mail_tld = $displaytld ? ".".$tab2[1] : " "; + $mail_tld = ''; + + for($i=1; $i < count($tab2) && $displaytld ;$i++){ + $mail_tld .= '.'.$tab2[$i]; + } for($i=0; $i < $nbreplace; $i++){ $string_replace .= $replace; From eb06c8a33edec61ed7bfa9c5470465c2d3945e56 Mon Sep 17 00:00:00 2001 From: jfefe Date: Sat, 11 Oct 2014 04:25:32 +0200 Subject: [PATCH 32/43] Allow to make PUT request with getURLContent() function --- htdocs/core/lib/geturl.lib.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index 8a9ac1385be..50c02125fb7 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -72,6 +72,13 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea curl_setopt($ch, CURLOPT_POST, 1); // POST curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // Setting param x=a&y=z as POST fields } + else if ($postorget == 'PUT') + { + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT' + if ( ! is_array($param) ) + parse_str($param, $array_param); + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($array_param)); // Setting param x=a&y=z as PUT fields + } else if ($postorget == 'HEAD') { curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD'); // HTTP request is 'HEAD' From 52e1bd2ad1353c9acdce74e2a22ac2e4b6fe9fc4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Oct 2014 23:46:49 +0200 Subject: [PATCH 33/43] Merge --- htdocs/core/lib/functions2.lib.php | 82 +++++++++++++++--------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index ba1cc230258..e6f6228eec9 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -480,47 +480,47 @@ function clean_url($url,$http=1) } - -/** - * Returns an email value with obfuscated parts. - * - * @param string $mail Email - * @param string $replace Replacement character (defaul : *) - * @param int $nbreplace Number of replacement character (default : 8) - * @param int $nbdisplaymail Number of character unchanged (default: 4) - * @param int $nbdisplaydomain Number of character unchanged of domain (default: 3) - * @param bool $displaytld Display tld (default: true) - * @return string Return email with hidden parts or ''; - */ -function dolObfuscateEmail($mail, $replace="*", $nbreplace=8, $nbdisplaymail=4, $nbdisplaydomain=3, $displaytld=true) -{ - if(!isValidEmail($mail))return ''; - $tab = explode('@', $mail); - $tab2 = explode('.',$tab[1]); - $string_replace = ''; - $mail_name = $tab[0]; - $mail_domaine = $tab2[0]; - $mail_tld = ''; - - for($i=1; $i < count($tab2) && $displaytld ;$i++) - { - $mail_tld .= '.'.$tab2[$i]; - } - - for($i=0; $i < $nbreplace; $i++){ - $string_replace .= $replace; - } - - if(strlen($mail_name) > $nbdisplaymail){ - $mail_name = substr($mail_name, 0, $nbdisplaymail); - } - - if(strlen($mail_domaine) > $nbdisplaydomain){ - $mail_domaine = substr($mail_domaine, strlen($mail_domaine)-$nbdisplaydomain); - } - - return $mail_name . $string_replace . $mail_domaine . $mail_tld; -} + +/** + * Returns an email value with obfuscated parts. + * + * @param string $mail Email + * @param string $replace Replacement character (defaul : *) + * @param int $nbreplace Number of replacement character (default : 8) + * @param int $nbdisplaymail Number of character unchanged (default: 4) + * @param int $nbdisplaydomain Number of character unchanged of domain (default: 3) + * @param bool $displaytld Display tld (default: true) + * @return string Return email with hidden parts or ''; + */ +function dolObfuscateEmail($mail, $replace="*", $nbreplace=8, $nbdisplaymail=4, $nbdisplaydomain=3, $displaytld=true) +{ + if(!isValidEmail($mail))return ''; + $tab = explode('@', $mail); + $tab2 = explode('.',$tab[1]); + $string_replace = ''; + $mail_name = $tab[0]; + $mail_domaine = $tab2[0]; + $mail_tld = ''; + + for($i=1; $i < count($tab2) && $displaytld ;$i++) + { + $mail_tld .= '.'.$tab2[$i]; + } + + for($i=0; $i < $nbreplace; $i++){ + $string_replace .= $replace; + } + + if(strlen($mail_name) > $nbdisplaymail){ + $mail_name = substr($mail_name, 0, $nbdisplaymail); + } + + if(strlen($mail_domaine) > $nbdisplaydomain){ + $mail_domaine = substr($mail_domaine, strlen($mail_domaine)-$nbdisplaydomain); + } + + return $mail_name . $string_replace . $mail_domaine . $mail_tld; +} /** From fc63e8b9dca213abc65fc2055c89da0788fad069 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Oct 2014 23:55:10 +0200 Subject: [PATCH 34/43] Fix: ErrorBadValueForParamNotAString error message in price customer multiprice --- htdocs/product/price.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index b208cba1c7e..856a68face6 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -365,10 +365,14 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) { // Prix mini print '' . $langs->trans("MinPrice") . ' ' . $i . ''; - if ($object->multiprices_base_type ["$i"] == 'TTC') { - print price($object->multiprices_min_ttc ["$i"]) . ' ' . $langs->trans($object->multiprices_base_type ["$i"]); - } else { - print price($object->multiprices_min ["$i"]) . ' ' . $langs->trans($object->multiprices_base_type ["$i"]); + if (empty($object->multiprices_base_type["$i"])) $object->multiprices_base_type["$i"]="HT"; + if ($object->multiprices_base_type["$i"] == 'TTC') + { + print price($object->multiprices_min_ttc["$i"]) . ' ' . $langs->trans($object->multiprices_base_type["$i"]); + } + else + { + print price($object->multiprices_min["$i"]) . ' ' . $langs->trans($object->multiprices_base_type["$i"]); } print ''; From c184253951cfa64952d5ee6399472611255ecf22 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Oct 2014 23:56:45 +0200 Subject: [PATCH 35/43] Update doc --- ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 294fc64ff5a..90067f92312 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,11 @@ English Dolibarr ChangeLog -------------------------------------------------------------- + +***** ChangeLog for 3.6.2 compared to 3.6.1 ***** +- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice + + ***** ChangeLog for 3.6.1 compared to 3.6.* ***** For users: - Fix: Can upload files on services. From f7a44347cb0e951982157b2a0006a5a3da81a60a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 12 Oct 2014 00:23:19 +0200 Subject: [PATCH 36/43] Lowecased booleans to fit with PSR-2 specification. --- htdocs/accountancy/admin/account.php | 2 +- htdocs/accountancy/admin/export.php | 2 +- htdocs/accountancy/admin/importaccounts.php | 2 +- htdocs/accountancy/admin/index.php | 4 ++-- htdocs/accountancy/admin/productaccount.php | 2 +- htdocs/commande/customer.php | 2 +- htdocs/commande/index.php | 8 ++++---- htdocs/commande/orderstoinvoice.php | 2 +- htdocs/compta/clients.php | 2 +- htdocs/compta/facture/fiche-rec.php | 6 +++--- htdocs/compta/facture/impayees.php | 2 +- htdocs/compta/facture/list.php | 2 +- htdocs/compta/facture/prelevement.php | 2 +- htdocs/compta/index.php | 4 ++-- htdocs/compta/paiement.php | 4 ++-- htdocs/compta/paiement_charge.php | 2 +- 16 files changed, 24 insertions(+), 24 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 0c929ef5de5..3b20885b897 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -160,7 +160,7 @@ if ($result) { print ''; print ''; - $var = True; + $var = true; while ( $i < min($num, $limit) ) { $obj = $db->fetch_object($resql); diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index ca7e5f84e07..dc8f50241a1 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -99,7 +99,7 @@ print '' print ''; print ''; -$var = True; +$var = true; print ''; print ''; diff --git a/htdocs/accountancy/admin/importaccounts.php b/htdocs/accountancy/admin/importaccounts.php index b350aa8e590..9e5c59f4555 100644 --- a/htdocs/accountancy/admin/importaccounts.php +++ b/htdocs/accountancy/admin/importaccounts.php @@ -135,7 +135,7 @@ if ($result) { print '' . "\n"; print ''; - $var = True; + $var = true; while ( $i < min($num_lines, $limit) ) { $objp = $db->fetch_object($result); $var = ! $var; diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 8e548f8992e..e72df6a0431 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -191,7 +191,7 @@ print "
\n"; * Define Chart of accounts */ print '
' . $langs->trans("Modelcsv") . '
'; -$var = True; +$var = true; print ''; print ''; print ''; - $var = True; + $var = true; while ( $i < min($num, 250) ) { $obj = $db->fetch_object($resql); diff --git a/htdocs/commande/customer.php b/htdocs/commande/customer.php index f40277ea34a..333ce5f7908 100644 --- a/htdocs/commande/customer.php +++ b/htdocs/commande/customer.php @@ -146,7 +146,7 @@ if ($resql) print ''; print "\n"; - $var=True; + $var=true; while ($i < min($num,$conf->liste_limit)) { diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index b7d9be05529..0d2815a6d67 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -187,7 +187,7 @@ if (! empty($conf->commande->enabled)) if ($num) { $i = 0; - $var = True; + $var = true; while ($i < $num) { $var=!$var; @@ -238,7 +238,7 @@ if ($resql) if ($num) { $i = 0; - $var = True; + $var = true; while ($i < $num) { $var=!$var; @@ -308,7 +308,7 @@ if (! empty($conf->commande->enabled)) if ($num) { $i = 0; - $var = True; + $var = true; while ($i < $num) { $var=!$var; @@ -379,7 +379,7 @@ if (! empty($conf->commande->enabled)) if ($num) { $i = 0; - $var = True; + $var = true; while ($i < $num) { $var=!$var; diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index 49824a7f6cb..1009b030210 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -622,7 +622,7 @@ if (($action != 'create' && $action != 'add') || !$error) print ''; print ''; - $var=True; + $var=true; $generic_commande = new Commande($db); while ($i < $num) diff --git a/htdocs/compta/clients.php b/htdocs/compta/clients.php index 528ed14e849..14751d308c4 100644 --- a/htdocs/compta/clients.php +++ b/htdocs/compta/clients.php @@ -177,7 +177,7 @@ if ($resql) print ''; print "\n"; - $var=True; + $var=true; while ($i < min($num,$conf->liste_limit)) { diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 02674b59745..55ef0a5ef80 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -228,7 +228,7 @@ if ($action == 'create') if (empty($conf->global->PRODUIT_MULTIPRICES)) print ''; print "\n"; } - $var=True; + $var=true; while ($i < $num) { $objp = $db->fetch_object($result); @@ -447,7 +447,7 @@ else $num = count($object->lines); $i = 0; - $var=True; + $var=true; while ($i < $num) { $var=!$var; @@ -572,7 +572,7 @@ else if ($num > 0) { - $var=True; + $var=true; while ($i < min($num,$limit)) { $objp = $db->fetch_object($resql); diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php index d3987bcbad8..ea0d896f5d1 100644 --- a/htdocs/compta/facture/impayees.php +++ b/htdocs/compta/facture/impayees.php @@ -600,7 +600,7 @@ if ($resql) if ($num > 0) { - $var=True; + $var=true; $total_ht=0; $total_tva=0; $total_ttc=0; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 39dcc6b6427..ba27f5659a9 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -333,7 +333,7 @@ if ($resql) if ($num > 0) { - $var=True; + $var=true; $total_ht=0; $total_tva=0; $total_ttc=0; diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 4bfa4d81048..48ca10afd2d 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -491,7 +491,7 @@ if ($object->id > 0) print ''; print ''; print ''; - $var=True; + $var=true; if ($result_sql) { diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 1908b0670ff..fc2943f05e0 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -494,7 +494,7 @@ if (! empty($conf->don->enabled) && $user->rights->societe->lire) print ''; if ($num) { - $var = True; + $var = true; $total_ttc = $totalam = $total = 0; $var=true; @@ -908,7 +908,7 @@ if ($resql) print '
'; @@ -211,7 +211,7 @@ $sql .= " AND fk_pays = " . $mysoc->country_id; dol_syslog('accountancy/admin/index.php:: $sql=' . $sql); $resql = $db->query($sql); -$var = True; +$var = true; if ($resql) { $num = $db->num_rows($resql); diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 5c1cba946ee..402ff72ed84 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -89,7 +89,7 @@ if ($resql) { print '' . $langs->trans("Accountancy_code_sell") . '' . $langs->trans("Accountancy_code_sell_suggest") . '
'.$langs->trans("CurrentProductPrice").'
'.$langs->trans("WithdrawalReceipt").''.$langs->trans("User").'  
'; print ''; print "\n"; - $var = True; + $var = true; $i = 0; while ($i < $db->num_rows($resql)) { diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 21b2eb9e154..56278f15c5d 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -509,7 +509,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; print "\n"; - $var=True; + $var=true; $total=0; $totalrecu=0; $totalrecucreditnote=0; @@ -687,7 +687,7 @@ if (! GETPOST('action')) { $num = $db->num_rows($resql); $i = 0; - $var=True; + $var=true; print_barre_liste($langs->trans('Payments'), $page, $_SERVER["PHP_SELF"],'',$sortfield,$sortorder,'',$num); print '
'.$langs->trans("TasksToDo").'
 
'; diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index a54a0bcd935..7e26fa5789f 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -253,7 +253,7 @@ if ($_GET["action"] == 'create') print ''; print "\n"; - $var=True; + $var=true; $total=0; $totalrecu=0; From 2b479aa0b42b28e9921e0510f65e38ecf7c7ceef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 12 Oct 2014 01:04:34 +0200 Subject: [PATCH 37/43] Qual: Uniformize translated label of progress on all pages. Fix: Color of first line of documents. Fix: The calculated progress was not calculated. --- htdocs/core/class/html.form.class.php | 4 +- htdocs/core/class/html.formfile.class.php | 4 +- htdocs/core/lib/project.lib.php | 12 +++--- htdocs/langs/en_US/main.lang | 1 + htdocs/projet/activity/list.php | 2 +- htdocs/projet/class/task.class.php | 48 +++++++++++++++++++-- htdocs/projet/tasks.php | 2 +- htdocs/projet/tasks/task.php | 20 ++++++--- htdocs/projet/tasks/time.php | 52 +++++++++++++++++------ 9 files changed, 112 insertions(+), 33 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 51b9c5eff46..d4effca3905 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3987,7 +3987,7 @@ class Form { print ''; } - print $langs->trans('Hours'); + print ' '.$langs->trans('HourShort'); if ($minunderhours) print '
'; else print " "; @@ -4000,7 +4000,7 @@ class Form print '>'.$min.''; } print ""; - print $langs->trans('Minutes'). " "; + print ' '.$langs->trans('MinuteShort'). " "; } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index e473fdc3d98..8c53356fa67 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -629,7 +629,7 @@ class FormFile if (count($file_list) == 0 && $headershown) { - $out.='
'; + $out.=''; } $this->numoffiles++; @@ -1150,7 +1150,7 @@ class FormFile $nboflinks = count($links); if ($nboflinks > 0) include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; - $var = true; + $var = false; foreach ($links as $link) { $var =! $var; diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index d8ecc52f6d9..98a2b111c6f 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2014 Laurent Destailleur * Copyright (C) 2010 Regis Houssin * Copyright (C) 2011 Juanjo Menent * @@ -455,12 +455,14 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t */ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=0) { - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; - global $db, $user, $bc, $langs; - global $form, $projectstatic, $taskstatic; + global $form, $formother, $projectstatic, $taskstatic; - $formother = new FormOther($db); + if (! is_object($formother)) + { + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; + $formother = new FormOther($db); + } $lastprojectid=0; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 1256dd533e3..7663f520667 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -266,6 +266,7 @@ Afternoon=Afternoon Quadri=Quadri MonthOfDay=Month of the day HourShort=H +MinuteShort=mn Rate=Rate UseLocalTax=Include tax Bytes=Bytes diff --git a/htdocs/projet/activity/list.php b/htdocs/projet/activity/list.php index e83fe30e865..0c2cebc2e27 100644 --- a/htdocs/projet/activity/list.php +++ b/htdocs/projet/activity/list.php @@ -179,7 +179,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print ''; print ''; print "\n"; diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index ad3736d3abe..2449d638405 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2008-2014 Laurent Destailleur * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2014 Marcos García * @@ -141,8 +141,9 @@ class Task extends CommonObject } } - //Update extrafield - if (!$error) { + // Update extrafield + if (! $error) + { if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { $result=$this->insertExtraFields(); @@ -816,6 +817,47 @@ class Task extends CommonObject return $ret; } + /** + * Calculate total of time spent for task + * + * @param int $id Id of object (here task) + * @return array Array of info for task array('min_date', 'max_date', 'total_duration') + */ + function getSummaryOfTimeSpent($id='') + { + global $langs; + + if (empty($id)) $id=$this->id; + + $result=array(); + + $sql = "SELECT"; + $sql.= " MIN(t.task_datehour) as min_date,"; + $sql.= " MAX(t.task_datehour) as max_date,"; + $sql.= " SUM(t.task_duration) as total_duration"; + $sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; + $sql.= " WHERE t.fk_task = ".$id; + + dol_syslog(get_class($this)."::getSummaryOfTimeSpent", LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + $obj = $this->db->fetch_object($resql); + + $result['min_date'] = $obj->min_date; + $result['max_date'] = $obj->max_date; + $result['total_duration'] = $obj->total_duration; + + $this->db->free($resql); + return $result; + } + else + { + dol_print_error($this->db); + return $result; + } + } + /** * Load object in memory from database * diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 7aea9314e5a..eaec5ae0816 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -320,7 +320,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print ''; // Progress - print ''; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index da200d565b6..ac6c72ec44c 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -351,8 +351,8 @@ if ($id > 0 || ! empty($ref)) print $form->select_duration('planned_workload',$object->planned_workload,0,'text'); print ''; - // Progress - print ''; @@ -383,7 +383,7 @@ if ($id > 0 || ! empty($ref)) { /* * Fiche tache en mode visu - */ + */ $param=($withproject?'&withproject=1':''); $linkback=$withproject?''.$langs->trans("BackToList").'':''; @@ -440,14 +440,20 @@ if ($id > 0 || ! empty($ref)) print convertSecondToTime($object->planned_workload,'allhourmin'); print ''; - // Progress + // Progress declared print ''; - // Progress + // Progress calculated print ''; // Description @@ -504,7 +510,7 @@ if ($id > 0 || ! empty($ref)) /* * Documents generes - */ + */ $filename=dol_sanitizeFileName($projectstatic->ref). "/". dol_sanitizeFileName($object->ref); $filedir=$conf->projet->dir_output . "/" . dol_sanitizeFileName($projectstatic->ref). "/" .dol_sanitizeFileName($object->ref); $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index eff94d532e5..f7b9f28e16a 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1,6 +1,6 @@ - * Copyright (C) 2006-2013 Laurent Destailleur + * Copyright (C) 2006-2014 Laurent Destailleur * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent * @@ -181,7 +181,7 @@ if (! empty($project_ref) && ! empty($withproject)) /* * View -*/ + */ llxHeader("",$langs->trans("Task")); @@ -193,7 +193,7 @@ if ($id > 0 || ! empty($ref)) { /* * Fiche projet en mode visu - */ + */ if ($object->fetch($id) >= 0) { $result=$projectstatic->fetch($object->fk_project); @@ -292,9 +292,37 @@ if ($id > 0 || ! empty($ref)) // Label print ''; - // Planned workload - print ''; - + // Date start + print ''; + + // Date end + print ''; + + // Planned workload + print ''; + + // Progress declared + print ''; + + // Progress calculated + print ''; + // Project if (empty($withproject)) { @@ -316,7 +344,7 @@ if ($id > 0 || ! empty($ref)) /* * Add time spent - */ + */ if ($user->rights->projet->creer) { print '
'; @@ -333,7 +361,7 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print "\n"; @@ -363,14 +391,14 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; - // Progress + // Progress declared print ''; // Duration print ''; print ''; } else @@ -492,7 +492,7 @@ class FormFile } // Language code (if multilang) - $out.= ''; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 7663f520667..fd2a7d94c76 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -680,7 +680,7 @@ ViewPrivateNote=View notes XMoreLines=%s line(s) hidden PublicUrl=Public URL AddBox=Add box - +SelectElementAndClickRefresh=Select an element and click Refresh # Week day Monday=Monday Tuesday=Tuesday diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index c6909aa7cae..e9e79d52130 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -2157,7 +2157,7 @@ else if (empty($conf->global->SOCIETE_DISABLE_BUILDDOC)) { - print '
'; + print '
'; print ''; // ancre /* @@ -2172,7 +2172,7 @@ else $somethingshown=$formfile->show_documents('company',$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang); - print '
'; + print '
'; print '
'; From 65f47f7d10c0eacedeb0c453284175238ed47f24 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 12 Oct 2014 12:22:45 +0200 Subject: [PATCH 43/43] New: Add number of active notification into tab title (like we do for notes and documents) --- ChangeLog | 1 + htdocs/core/lib/company.lib.php | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d531ec987b3..0526cd214a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.7 compared to 3.6.* ***** For users: +- New: Add number of active notification into tab title (like we do for notes and documents) - New: Can add product into category from category card. - New: PDF event report show project and status of event. - New: Can filter on status on interventions. diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index d897dc766e0..c5ba612b60f 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -37,7 +37,7 @@ */ function societe_prepare_head($object) { - global $langs, $conf, $user; + global $db, $langs, $conf, $user; $h = 0; $head = array(); @@ -109,8 +109,29 @@ function societe_prepare_head($object) // Notifications if (! empty($conf->notification->enabled)) { + $nbNote = 0; + $sql = "SELECT COUNT(n.rowid) as nb"; + $sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n"; + $sql.= " WHERE fk_soc = ".$object->id; + $resql=$db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) + { + $obj = $db->fetch_object($resql); + $nbNote=$obj->nb; + $i++; + } + } + else { + dol_print_error($db); + } + $head[$h][0] = DOL_URL_ROOT.'/societe/notify/card.php?socid='.$object->id; $head[$h][1] = $langs->trans("Notifications"); + if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')'; $head[$h][2] = 'notify'; $h++; }
'.$langs->trans("Amount").'
'.$langs->trans("None").'
'.$langs->trans("None").'
'.$langs->trans("LabelTask").''.$langs->trans("DateStart").''.$langs->trans("DateEnd").''.$langs->trans("PlannedWorkload").''.$langs->trans("Progress").''.$langs->trans("ProgressDeclared").''.$langs->trans("TimeSpent").''.$langs->trans("AddDuration").'
'.$langs->trans("Progress").''; + print '
'.$langs->trans("ProgressDeclared").''; print $formother->select_percent($progress,'progress'); print '
'.$langs->trans("Progress").''; + // Progress declared + print '
'.$langs->trans("ProgressDeclared").''; print $formother->select_percent($object->progress,'progress'); print '
'.$langs->trans("ProgressDeclared").''; print $object->progress.' %'; print '
'.$langs->trans("ProgressCalculated").''; - print $object->progress.' %'; + if ($object->planned_workload) + { + $tmparray=$object->getSummaryOfTimeSpent(); + if ($tmparray['total_duration'] > 0) print round($tmparray['total_duration']/$object->planned_workload*100, 2).' %'; + else print '0 %'; + } + else print ''; print '
'.$langs->trans("Label").''.$object->label.'
'.$langs->trans("PlannedWorkload").''.convertSecondToTime($object->planned_workload,'allhourmin').'
'.$langs->trans("DateStart").''; + print dol_print_date($object->date_start,'dayhour'); + print '
'.$langs->trans("DateEnd").''; + print dol_print_date($object->date_end,'dayhour'); + print '
'.$langs->trans("PlannedWorkload").''; + print convertSecondToTime($object->planned_workload,'allhourmin'); + print '
'.$langs->trans("ProgressDeclared").''; + print $object->progress.' %'; + print '
'.$langs->trans("ProgressCalculated").''; + if ($object->planned_workload) + { + $tmparray=$object->getSummaryOfTimeSpent(); + if ($tmparray['total_duration'] > 0) print round($tmparray['total_duration']/$object->planned_workload*100, 2).' %'; + else print '0 %'; + } + else print ''; + print '
'.$langs->trans("Date").''.$langs->trans("By").''.$langs->trans("Note").''.$langs->trans("Progress").''.$langs->trans("ProgressDeclared").''.$langs->trans("Duration").' 
'; - print $formother->select_percent($object->progress,'progress'); + print $formother->select_percent(GETPOST('progress')?GETPOST('progress'):$object->progress,'progress'); print ''; - print $form->select_duration('timespent_duration',($_POST['timespent_duration']?$_POST['timespent_duration']:''),0,'text'); + print $form->select_duration('timespent_duration', ($_POST['timespent_duration']?$_POST['timespent_duration']:''), 0, 'text'); print ''; @@ -384,7 +412,7 @@ if ($id > 0 || ! empty($ref)) /* * List of time spent - */ + */ $sql = "SELECT t.rowid, t.task_date, t.task_duration, t.fk_user, t.note"; $sql.= ", u.lastname, u.firstname"; $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; From 44e2cd21940b14092363f8f66c5903427ec4d24f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 12 Oct 2014 01:20:03 +0200 Subject: [PATCH 38/43] Prepare code to manage task_datehour with task_date. --- htdocs/install/mysql/migration/repair.sql | 2 ++ htdocs/projet/class/task.class.php | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index fbc1572a2ab..57a89440343 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -149,6 +149,8 @@ UPDATE llx_actioncomm set fk_user_action = fk_user_done where fk_user_done > 0 a UPDATE llx_actioncomm set fk_user_action = fk_user_author where fk_user_author > 0 and (fk_user_action is null or fk_user_action = 0); +UPDATE llx_projet_task_time set task_datehour = task_date where task_datehour IS NULL and task_date IS NOT NULL; + -- Requests to clean old tables or external modules tables diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 2449d638405..2f25e2f3c2c 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -60,6 +60,7 @@ class Task extends CommonObject var $timespent_duration; var $timespent_old_duration; var $timespent_date; + var $timespent_datehour; // More accurate start date (same than timespent_date but includes hours, minutes and seconds) var $timespent_fk_user; var $timespent_note; @@ -744,18 +745,21 @@ class Task extends CommonObject // Clean parameters if (isset($this->timespent_note)) $this->timespent_note = trim($this->timespent_note); - + if (empty($this->timespent_datehour)) $this->timespent_datehour = $this->timespent_date; + $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task_time ("; $sql.= "fk_task"; $sql.= ", task_date"; + $sql.= ", task_datehour"; $sql.= ", task_duration"; $sql.= ", fk_user"; $sql.= ", note"; $sql.= ") VALUES ("; $sql.= $this->id; $sql.= ", '".$this->db->idate($this->timespent_date)."'"; + $sql.= ", '".$this->db->idate($this->timespent_datehour)."'"; $sql.= ", ".$this->timespent_duration; $sql.= ", ".$this->timespent_fk_user; $sql.= ", ".(isset($this->timespent_note)?"'".$this->db->escape($this->timespent_note)."'":"null"); @@ -919,12 +923,14 @@ class Task extends CommonObject $ret = 0; // Clean parameters + if (empty($this->timespent_datehour)) $this->timespent_datehour = $this->timespent_date; if (isset($this->timespent_note)) $this->timespent_note = trim($this->timespent_note); - + $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task_time SET"; $sql.= " task_date = '".$this->db->idate($this->timespent_date)."',"; + $sql.= " task_datehour = '".$this->db->idate($this->timespent_datehour)."',"; $sql.= " task_duration = ".$this->timespent_duration.","; $sql.= " fk_user = ".$this->timespent_fk_user.","; $sql.= " note = ".(isset($this->timespent_note)?"'".$this->db->escape($this->timespent_note)."'":"null"); From ac2ff5c6044ad1524579e986c8129e256f693385 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 12 Oct 2014 01:40:18 +0200 Subject: [PATCH 39/43] Update logs --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 90067f92312..a4e7edc94dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,7 +5,7 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice - +- Fix: bug 1588 : relative discount ***** ChangeLog for 3.6.1 compared to 3.6.* ***** For users: From 591b40e67461e3ddb89b782267b067fb8dae25d7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 12 Oct 2014 01:59:21 +0200 Subject: [PATCH 40/43] Some fix with export definition. Works now with pgql too. --- htdocs/core/modules/modAgenda.class.php | 4 ++-- htdocs/core/modules/modBanque.class.php | 2 +- htdocs/core/modules/modContrat.class.php | 25 ++++++++++++------------ test/phpunit/ContratTest.php | 2 +- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 7533018373a..c633734b227 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2009-2011 Regis Houssin @@ -394,7 +394,7 @@ class modAgenda extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s on ac.fk_soc = s.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co on s.fk_pays = co.rowid'; $this->export_sql_end[$r] .=' Where ac.entity = '.$conf->entity; - $this->export_sql_end[$r] .=' ORDER BY datep'; + $this->export_sql_end[$r] .=' ORDER BY ac.datep'; } diff --git a/htdocs/core/modules/modBanque.class.php b/htdocs/core/modules/modBanque.class.php index 43fbe916c47..0d383603a06 100644 --- a/htdocs/core/modules/modBanque.class.php +++ b/htdocs/core/modules/modBanque.class.php @@ -182,7 +182,7 @@ class modBanque extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture as f ON f.rowid = pf.fk_facture'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON f.fk_soc = s.rowid'; $this->export_sql_end[$r] .=' WHERE ba.rowid = b.fk_account AND bch.rowid = b.fk_bordereau and bch.fk_bank_account=ba.rowid'; - $this->export_sql_end[$r] .=' AND b.fk_type = "CHQ"'; + $this->export_sql_end[$r] .=" AND b.fk_type = 'CHQ'"; $this->export_sql_end[$r] .=' AND p.fk_paiement = 7'; $this->export_sql_end[$r] .=' AND ba.entity = '.$conf->entity; $this->export_sql_order[$r] =' ORDER BY b.datev, b.num_releve'; diff --git a/htdocs/core/modules/modContrat.class.php b/htdocs/core/modules/modContrat.class.php index e77067fc25e..4906d9e3954 100644 --- a/htdocs/core/modules/modContrat.class.php +++ b/htdocs/core/modules/modContrat.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2011 Juanjo Menent * This program is free software; you can redistribute it and/or modify @@ -41,6 +41,8 @@ class modContrat extends DolibarrModules */ function __construct($db) { + global $conf; + $this->db = $db; $this->numero = 54; @@ -122,31 +124,31 @@ class modContrat extends DolibarrModules $this->export_label[$r]='ContractAndServices'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_icon[$r]='contract'; $this->export_permission[$r]=array(array("contrat","export")); - $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','c.code'=>'CountryCode', - 's.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode', + $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode', + 's.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode', 's.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra', 'co.rowid'=>"contractId",'co.ref'=>"contactRef",'co.datec'=>"contractDateCreation",'co.date_contrat'=>"DateContract",'co.mise_en_service'=>"DateMiseService", - 'co.fin_validite'=>"EndValidity",'co.date_cloture'=>"Cloture",'co.fk_statut'=>'ContractStatus','co.note'=>"NotePrivate",'co.note_public'=>"NotePublic", + 'co.fin_validite'=>"EndValidity",'co.date_cloture'=>"Cloture",'co.note_private'=>"NotePrivate",'co.note_public'=>"NotePublic", 'cod.rowid'=>'LineId','cod.label'=>"LineLabel",'cod.description'=>"LineDescription",'cod.price_ht'=>"LineUnitPrice",'cod.tva_tx'=>"LineVATRate", 'cod.qty'=>"LineQty",'cod.total_ht'=>"LineTotalHT",'cod.total_tva'=>"LineTotalVAT",'cod.total_ttc'=>"LineTotalTTC", 'cod.date_ouverture'=>"DateStart",'cod.date_ouverture_prevue'=>"DateStartPrevis",'cod.date_fin_validite'=>"EndValidity",'cod.date_cloture'=>"DateEnd", 'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); - $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company', - 's.ville'=>'company','c.code'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company', + $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company', + 's.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company', 's.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company', 'co.rowid'=>"Contract",'co.ref'=>"Contract",'co.datec'=>"Contract",'co.date_contrat'=>"Contract",'co.mise_en_service'=>"Contract", - 'co.fin_validite'=>"Contract",'co.date_cloture'=>"Contract",'co.fk_statut'=>'Contract','co.note'=>"Contract",'co.note_public'=>"Contract", + 'co.fin_validite'=>"Contract",'co.date_cloture'=>"Contract",'co.note_private'=>"Contract",'co.note_public'=>"Contract", 'cod.rowid'=>'contract_line','cod.label'=>"contract_line",'cod.description'=>"contract_line",'cod.price_ht'=>"contract_line",'cod.tva_tx'=>"contract_line", 'cod.qty'=>"contract_line",'cod.total_ht'=>"contract_line",'cod.total_tva'=>"contract_line",'cod.total_ttc'=>"contract_line", 'cod.date_ouverture'=>"contract_line",'cod.date_ouverture_prevue'=>"contract_line",'cod.date_fin_validite'=>"contract_line",'cod.date_cloture'=>"contract_line", 'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product'); - $this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','c.code'=>'Text', - 's.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text', + $this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text', + 's.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text', 'co.ref'=>"Text",'co.datec'=>"Date",'co.date_contrat'=>"Date",'co.mise_en_service'=>"Date", - 'co.fin_validite'=>"Date",'co.date_cloture'=>"Date",'co.fk_statut'=>'Statut','co.note'=>"Text",'co.note_public'=>"Text", + 'co.fin_validite'=>"Date",'co.date_cloture'=>"Date",'co.note_private'=>"Text",'co.note_public'=>"Text", 'cod.label'=>"Text",'cod.description'=>"Text",'cod.price_ht'=>"Numeric",'cod.tva_tx'=>"Numeric", 'cod.qty'=>"Numeric",'cod.total_ht'=>"Numeric",'cod.total_tva'=>"Numeric",'cod.total_ttc'=>"Numeric", 'cod.date_ouverture'=>"Date",'cod.date_ouverture_prevue'=>"Date",'cod.date_fin_validite'=>"Date",'cod.date_cloture'=>"Date", @@ -155,13 +157,12 @@ class modContrat extends DolibarrModules $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_pays as c on s.fk_pays = c.rowid,'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid,'; $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'contrat as co,'; $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'contratdet as cod'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (cod.fk_product = p.rowid)'; $this->export_sql_end[$r] .=' WHERE co.fk_soc = s.rowid and co.rowid = cod.fk_contrat'; $this->export_sql_end[$r] .=' AND co.entity = '.$conf->entity; - } diff --git a/test/phpunit/ContratTest.php b/test/phpunit/ContratTest.php index c42d62cd3b1..149d867135e 100644 --- a/test/phpunit/ContratTest.php +++ b/test/phpunit/ContratTest.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2010-2014 Laurent Destailleur * * 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 From c30f13a03d9f9bba6f390b8ab5bf583629379e89 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 12 Oct 2014 02:07:50 +0200 Subject: [PATCH 41/43] Fix: label of input method not translated. --- ChangeLog | 1 + htdocs/fourn/class/fournisseur.commande.class.php | 15 +++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index a4e7edc94dd..12694302fda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice - Fix: bug 1588 : relative discount +- Fix: label of input method not tranlated. ***** ChangeLog for 3.6.1 compared to 3.6.* ***** For users: diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 155c8111f81..3aa9d77f5de 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2016,7 +2016,8 @@ class CommandeFournisseur extends CommonOrder } /** - * Returns the translated input method + * Returns the translated input method of object (defined if $this->methode_commande_id > 0). + * This function make a sql request to get translation. No cache yet, try to not use it inside a loop. * * @return string */ @@ -2026,21 +2027,19 @@ class CommandeFournisseur extends CommonOrder if ($this->methode_commande_id > 0) { - $sql = "SELECT rowid, code, libelle"; + $sql = "SELECT rowid, code, libelle as label"; $sql.= " FROM ".MAIN_DB_PREFIX.'c_input_method'; $sql.= " WHERE active=1 AND rowid = ".$db->escape($this->methode_commande_id); $query = $db->query($sql); - if ($query && $db->num_rows($query)) { - $result = $db->fetch_object($query); + $obj = $db->fetch_object($query); - $string = $langs->trans($result->code); - - if ($string == $result->code) + $string = $langs->trans($obj->code); + if ($string == $obj->code) { - $string = $obj->libelle != '-' ? $obj->libelle : ''; + $string = $obj->label != '-' ? $obj->label : ''; } return $string; From f08759a17e5a06b670e48cad779d90bf1a3f7270 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 12 Oct 2014 11:59:52 +0200 Subject: [PATCH 42/43] Fix: area to generate doc must use half size not onethird. Fix: Missing maxwidthonsmartphone. Fix: Missing backtopage Fix: Missing translation key --- htdocs/contact/card.php | 27 ++++++++++++++--------- htdocs/contact/class/contact.class.php | 7 +++--- htdocs/core/class/html.formfile.class.php | 8 +++---- htdocs/core/lib/company.lib.php | 2 +- htdocs/langs/en_US/main.lang | 2 +- htdocs/societe/soc.php | 4 ++-- 6 files changed, 29 insertions(+), 21 deletions(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index f3abf9e2bfe..1ba775268a1 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -241,13 +241,20 @@ if (empty($reshook)) $result = $object->delete(); if ($result > 0) { - header("Location: ".DOL_URL_ROOT.'/contact/list.php'); - exit; + if ($backtopage) + { + header("Location: ".$backtopage); + exit; + } + else + { + header("Location: ".DOL_URL_ROOT.'/contact/list.php'); + exit; + } } else { - setEventMessage($object->error,'errors'); - setEventMessage($object->errors,'errors'); + setEventMessage($object->error,$object->errors,'errors'); } } @@ -360,7 +367,7 @@ else { if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteContact"),$langs->trans("ConfirmDeleteContact"),"confirm_delete",'',0,1); + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id.($backtopage?'&backtopage='.$backtopage:''),$langs->trans("DeleteContact"),$langs->trans("ConfirmDeleteContact"),"confirm_delete",'',0,1); } } @@ -1082,27 +1089,27 @@ else { if ($user->rights->societe->contact->creer) { - print ''.$langs->trans('Modify').''; + print ''.$langs->trans('Modify').''; } if (! $object->user_id && $user->rights->user->user->creer) { - print ''.$langs->trans("CreateDolibarrLogin").''; + print ''.$langs->trans("CreateDolibarrLogin").''; } if ($user->rights->societe->contact->supprimer) { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } // Activer if ($object->statut == 0 && $user->rights->societe->contact->creer) { - print ''.$langs->trans("Reactivate").''; + print ''.$langs->trans("Reactivate").''; } // Desactiver if ($object->statut == 1 && $user->rights->societe->contact->creer) { - print ''.$langs->trans("DisableUser").''; + print ''.$langs->trans("DisableUser").''; } } diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 9e93523a654..3f81608c415 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -877,20 +877,21 @@ class Contact extends CommonObject * @param int $withpicto Include picto with link * @param string $option Where the link point to * @param int $maxlen Max length of + * @param string $moreparam Add more param into URL * @return string String with URL */ - function getNomUrl($withpicto=0,$option='',$maxlen=0) + function getNomUrl($withpicto=0,$option='',$maxlen=0,$moreparam='') { global $langs; $result=''; - $lien = ''; + $lien = ''; $lienfin=''; if ($option == 'xxx') { - $lien = ''; + $lien = ''; $lienfin=''; } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 8c53356fa67..50c681d8366 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -474,14 +474,14 @@ class FormFile // Model if (! empty($modellist)) { - $out.= ''; + $out.= ''; $out.= ''.$langs->trans('Model').' '; if (is_array($modellist) && count($modellist) == 1) // If there is only one element { $arraykeys=array_keys($modellist); $modelselected=$arraykeys[0]; } - $out.= $form->selectarray('model',$modellist,$modelselected,$showempty,0,0); + $out.= $form->selectarray('model', $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', ''); $out.= ''; + $out.= ''; if (($allowgenifempty || (is_array($modellist) && count($modellist) > 0)) && $conf->global->MAIN_MULTILANGS && ! $forcenomultilang && (! empty($modellist) || $showempty)) { include_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; @@ -508,7 +508,7 @@ class FormFile // Button $addcolumforpicto=($delallowed || $printer || $morepicto); - $out.= ''; + $out.= ''; $genbutton = 'lastname = $obj->lastname; $contactstatic->firstname = $obj->firstname; $contactstatic->civility_id = $obj->civility_id; - print $contactstatic->getNomUrl(1); + print $contactstatic->getNomUrl(1,'',0,'&backtopage='.urlencode($backtopage)); print ''; print ''.$obj->poste.'