From ae9c7ad6b6b9668dddf46e9692053049735dd3b5 Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Mon, 5 Feb 2018 10:40:52 +0100 Subject: [PATCH 1/5] FIX unset categorie --- htdocs/societe/card.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 4807591b9f3..a5ad6f2e270 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -519,15 +519,15 @@ if (empty($reshook)) $error=$object->error; $errors=$object->errors; } } + if(!empty($user->rights->categorie->creer)){ + // Customer categories association + $custcats = GETPOST( 'custcats', 'array' ); + $object->setCategories($custcats, 'customer'); - // Customer categories association - $custcats = GETPOST( 'custcats', 'array' ); - $object->setCategories($custcats, 'customer'); - - // Supplier categories association - $suppcats = GETPOST('suppcats', 'array'); - $object->setCategories($suppcats, 'supplier'); - + // Supplier categories association + $suppcats = GETPOST('suppcats', 'array'); + $object->setCategories($suppcats, 'supplier'); + } // Logo/Photo save $dir = $conf->societe->multidir_output[$conf->entity]."/".$object->id."/logos/"; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); From bb93b98260dc2de3a82f37df1b424866877849c7 Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Mon, 5 Feb 2018 15:25:49 +0100 Subject: [PATCH 2/5] NEW field commerciaux and categ export CustomersInvoicesAndPayments --- htdocs/core/modules/modFacture.class.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 40e2a03d161..9c71ddea1d1 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -248,16 +248,19 @@ class modFacture extends DolibarrModules $this->export_label[$r]='CustomersInvoicesAndPayments'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_icon[$r]='invoice'; $this->export_permission[$r]=array(array("facture","facture","export")); - $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','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.type'=>"Type",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'none.rest'=>'Rest','f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','pj.ref'=>'ProjectRef','p.rowid'=>'PaymentId','p.ref'=>'PaymentRef','p.amount'=>'AmountPayment','pf.amount'=>'AmountPaymentDistributedOnInvoice','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber','pt.code'=>'CodePaymentMode','pt.libelle'=>'LabelPaymentMode','p.note'=>'PaymentNote','p.fk_bank'=>'IdTransaction','ba.ref'=>'AccountRef'); - $this->export_TypeFields_array[$r]=array('s.rowid'=>'Numeric','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','f.rowid'=>"Numeric",'f.facnumber'=>"Text",'f.type'=>"Numeric",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'none.rest'=>'NumericCompute','f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'f.fk_user_author'=>'Numeric','uc.login'=>'Text','f.fk_user_valid'=>'Numeric','uv.login'=>'Text','pj.ref'=>'Text','p.amount'=>'Numeric','pf.amount'=>'Numeric','p.rowid'=>'Numeric','p.ref'=>'Text','p.datep'=>'Date','p.num_paiement'=>'Numeric','p.fk_bank'=>'Numeric','p.note'=>'Text','pt.code'=>'Text','pt.libelle'=>'text','ba.ref'=>'Text'); - $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','pj.ref'=>'project','p.rowid'=>'payment','p.ref'=>'payment','p.amount'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment','pt.code'=>'payment','pt.libelle'=>'payment','p.note'=>'payment','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user','p.fk_bank'=>'account','ba.ref'=>'account'); + $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','ucomm.lastname'=>'SalesRepresentatives','cat.label'=>'Category','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','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.type'=>"Type",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'none.rest'=>'Rest','f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','pj.ref'=>'ProjectRef','p.rowid'=>'PaymentId','p.ref'=>'PaymentRef','p.amount'=>'AmountPayment','pf.amount'=>'AmountPaymentDistributedOnInvoice','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber','pt.code'=>'CodePaymentMode','pt.libelle'=>'LabelPaymentMode','p.note'=>'PaymentNote','p.fk_bank'=>'IdTransaction','ba.ref'=>'AccountRef'); + $this->export_TypeFields_array[$r]=array('s.rowid'=>'Numeric','s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','ucomm.lastname'=>'Text','cat.label'=>'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','f.rowid'=>"Numeric",'f.facnumber'=>"Text",'f.type'=>"Numeric",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'none.rest'=>'NumericCompute','f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'f.fk_user_author'=>'Numeric','uc.login'=>'Text','f.fk_user_valid'=>'Numeric','uv.login'=>'Text','pj.ref'=>'Text','p.amount'=>'Numeric','pf.amount'=>'Numeric','p.rowid'=>'Numeric','p.ref'=>'Text','p.datep'=>'Date','p.num_paiement'=>'Numeric','p.fk_bank'=>'Numeric','p.note'=>'Text','pt.code'=>'Text','pt.libelle'=>'text','ba.ref'=>'Text'); + $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','ucomm.lastname'=>'company','cat.label'=>'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','pj.ref'=>'project','p.rowid'=>'payment','p.ref'=>'payment','p.amount'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment','pt.code'=>'payment','pt.libelle'=>'payment','p.note'=>'payment','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user','p.fk_bank'=>'account','ba.ref'=>'account'); $this->export_special_array[$r]=array('none.rest'=>'getRemainToPay'); $this->export_dependencies_array[$r]=array('payment'=>'p.rowid', 'none.rest'=>array('f.rowid','f.total_ttc')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $keyforselect='facture'; $keyforelement='invoice'; $keyforaliasextra='extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; - if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as ucomm ON sc.fk_user = ucomm.rowid'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_societe as cs ON cs.fk_soc = s.rowid'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cs.fk_categorie = cat.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.'facture as f'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON f.fk_projet = pj.rowid'; From 2081aefc84cf1156527c09b7e827b500423a4f00 Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Mon, 5 Feb 2018 16:07:08 +0100 Subject: [PATCH 3/5] FIX creer into lire --- htdocs/societe/card.php | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index a5ad6f2e270..611abc9b704 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -519,15 +519,16 @@ if (empty($reshook)) $error=$object->error; $errors=$object->errors; } } - if(!empty($user->rights->categorie->creer)){ - // Customer categories association - $custcats = GETPOST( 'custcats', 'array' ); - $object->setCategories($custcats, 'customer'); + + + // Customer categories association + $custcats = GETPOST( 'custcats', 'array' ); + $object->setCategories($custcats, 'customer'); - // Supplier categories association - $suppcats = GETPOST('suppcats', 'array'); - $object->setCategories($suppcats, 'supplier'); - } + // Supplier categories association + $suppcats = GETPOST('suppcats', 'array'); + $object->setCategories($suppcats, 'supplier'); + // Logo/Photo save $dir = $conf->societe->multidir_output[$conf->entity]."/".$object->id."/logos/"; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); @@ -634,15 +635,16 @@ if (empty($reshook)) { $error = $object->error; $errors = $object->errors; } + //Prevent thirdparty's emptying if a user hasn't rights $user->rights->categorie->lire + if(!empty($user->rights->categorie->lire)){ + // Customer categories association + $categories = GETPOST( 'custcats', 'array' ); + $object->setCategories($categories, 'customer'); - // Customer categories association - $categories = GETPOST( 'custcats', 'array' ); - $object->setCategories($categories, 'customer'); - - // Supplier categories association - $categories = GETPOST('suppcats', 'array'); - $object->setCategories($categories, 'supplier'); - + // Supplier categories association + $categories = GETPOST('suppcats', 'array'); + $object->setCategories($categories, 'supplier'); + } // Logo/Photo save $dir = $conf->societe->multidir_output[$object->entity]."/".$object->id."/logos"; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); From 9b5655596249c3e0367f63d44e4d9f8e59da95ca Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 6 Feb 2018 18:49:29 +0100 Subject: [PATCH 4/5] FIX: Withdrawals lines not filter by company name and not respect dropdown limit lines by page --- htdocs/compta/prelevement/list.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index 245903101cf..ff6fe4e109c 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -2,7 +2,7 @@ /* Copyright (C) 2005 Rodolphe Quiedeville * Copyright (C) 2005-2016 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2010-2012 Juanjo Menent + * Copyright (C) 2010-2018 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -101,7 +101,7 @@ if ($socid) $sql.= " AND s.rowid = ".$socid; if ($search_line) $sql.= " AND pl.rowid = '".$db->escape($search_line)."'"; if ($search_bon) $sql.= natural_search("p.ref", $search_bon); if ($search_code) $sql.= natural_search("s.code_client", $search_code); -if ($search_company) natural_search("s.nom", $search_company); +if ($search_company) $sql.= natural_search("s.nom", $search_company); $sql.= $db->order($sortfield,$sortorder); @@ -123,13 +123,14 @@ if ($result) $urladd = "&statut=".$statut; $urladd .= "&search_bon=".$search_bon; - - print_barre_liste($langs->trans("WithdrawalsLines"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit); + if ($limit > 0 && $limit != $conf->liste_limit) $urladd.='&limit='.urlencode($limit); print"\n\n"; print '
'; - $moreforfilter=''; + print_barre_liste($langs->trans("WithdrawalsLines"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit); + + $moreforfilter=''; print '
'; print ''."\n"; From 3f17c92aa3550b1131205e15b8c519c444821d17 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 Feb 2018 13:09:21 +0100 Subject: [PATCH 5/5] Update card.php --- htdocs/societe/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 611abc9b704..d3f629952b1 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -635,7 +635,7 @@ if (empty($reshook)) { $error = $object->error; $errors = $object->errors; } - //Prevent thirdparty's emptying if a user hasn't rights $user->rights->categorie->lire + // Prevent thirdparty's emptying if a user hasn't rights $user->rights->categorie->lire (in such a case, post of 'custcats' is not defined) if(!empty($user->rights->categorie->lire)){ // Customer categories association $categories = GETPOST( 'custcats', 'array' );