diff --git a/ChangeLog b/ChangeLog index f94820c21cd..c4b334c542a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -151,6 +151,12 @@ Fix: [ bug #1544 ] Can remove date from invoice. Fix: list event view lost type event filter. Fix: Add code save on create event. Fix: SQL injection. +Fix: [ bug #1589 ] Menu type in "Edit menu" page is not translated +Fix: [ bug #1591 ] Linked object block shows Total HT/TTC even if not having permission to read them +Fix: [ bug #1577 ] When creating new Private individual third, selected third type is ignored +Fix: [ bug #1555 ] Update accountancy code of products does not throw PRODUCT_MODIFY trigger +Fix: [ bug #1548 ] Supplier payment card shows type in French +Fix: [ bug #1546 ] Incorrect page number when searching in the list of bank transactions ***** ChangeLog for 3.5.4 compared to 3.5.3 ***** Fix: Hide title of event when agenda module disabled. diff --git a/build/debian/control b/build/debian/control index d22f556acaa..f4f9e12aa58 100755 --- a/build/debian/control +++ b/build/debian/control @@ -39,7 +39,7 @@ Description: Web based software to manage a company or foundation It's a web software you can install as a standalone program or on any web hosting provider to use it from anywhere with any web browser. . - Dolibarr was designed to be easy to use. Only the features that you need + Dolibarr was designed to be easy to use. Only the features that you need are visible, depending on which modules were activated. . This is an example of most common used modules: diff --git a/build/debian/copyright b/build/debian/copyright index d75283b535a..73109152034 100644 --- a/build/debian/copyright +++ b/build/debian/copyright @@ -61,7 +61,7 @@ License: GPL-3+ Files: htdocs/includes/adodbtime/* Copyright: 2003-2005, John Lim unknown, jackbbs -License: BSD +License: BSD-3-Clause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -272,7 +272,7 @@ Comment: Files: htdocs/includes/jquery/plugins/flot/* Copyright: Flot team -License: Public Domain +License: Public-Domain This work is not subject to copyright in any jurisdiction Comment: Those files are not shipped in the binary package because we configure diff --git a/build/debian/get-orig-source.sh b/build/debian/get-orig-source.sh index 57f87ab1999..418bbbc2199 100755 --- a/build/debian/get-orig-source.sh +++ b/build/debian/get-orig-source.sh @@ -8,16 +8,20 @@ echo "tmpdir = $tmpdir" if [ -n "$1" ]; then uscan_opts="--download-version=$1" fi -uscan --noconf --force-download --no-symlink --verbose --destdir=$tmpdir $uscan_opts +#uscan --noconf --force-download --no-symlink --verbose --destdir=$tmpdir $uscan_opts cd $tmpdir +# Other method to download (comment uscan if you use this) +wget http://www.dolibarr.org/files/stable/standard/dolibarr-3.5.4.tgz + +# Rename file to add +dfsg tgzfile=$(echo *.tgz) version=$(echo "$tgzfile" | perl -pi -e 's/^dolibarr-//; s/\.tgz$//; s/_/./g; s/\+nmu1//; ') cd - >/dev/null mv $tmpdir/dolibarr-${version}.tgz ../ -echo "File ../dolibarr-${version}.tgz is ready for git-import" +echo "File ../dolibarr-${version}.tgz is ready for git-import-orig" rm -rf $tmpdir diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index d99a02308b7..353cf3eaabe 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -317,7 +317,7 @@ if ($action == 'create') print ''.$langs->trans('Type').''; if ($parent_rowid) { - print 'Left'; + print $langs->trans('Left'); print ''; } else diff --git a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php index 632dee63965..cb920afd5fc 100644 --- a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php @@ -1,6 +1,7 @@ - * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2014 Marcos García * * 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 @@ -27,6 +28,8 @@ id ?>">trans("ShowPropal"),"propal").' '.$object->ref; ?> ref_client; ?> date,'day'); ?> - total_ht); ?> + rights->propale->lire) { + $total = $total + $object->total_ht; + echo price($object->total_ht); + } ?> getLibStatut(3); ?> total_ht; } ?> trans('TotalHT'); ?> - + rights->propale->lire) { + echo price($total); + } ?>   diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index c7d073501a3..d2fe19c5b6f 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -1,6 +1,7 @@ * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2014 Marcos García * * 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 @@ -22,6 +23,8 @@ > trans("ShowOrder"),"order").' '.$object->ref; ?> date,'day'); ?> - total_ht); ?> + rights->commande->lire) { + $total = $total + $object->total_ht; + echo price($object->total_ht); + } ?> getLibStatut(3); ?> total_ht; } ?> trans('TotalHT'); ?> - + rights->commande->lire) { + echo price($total); + } ?>   diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 0e16f6744fd..bd1928f3da4 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -5,7 +5,7 @@ * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2011 Juanjo Menent - * Copyright (C) 2012 Marcos García + * Copyright (C) 2012-2014 Marcos García * Copyright (C) 2011-2014 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -259,17 +259,22 @@ if ($id > 0 || ! empty($ref)) //Total pages $totalPages = ceil($total_lines/$viewline); - if ($page > 0) - { - $limitsql = ($totalPages - $page) * $viewline; - if ($limitsql < $viewline) $limitsql = $viewline; - $nbline = $limitsql; - } - else - { + if ($totalPages == 0) { $page = 0; - $limitsql = $nbline; + } else { + + if ($page > 0) { + $limitsql = ($totalPages - $page) * $viewline; + if ($limitsql < $viewline) { + $limitsql = $viewline; + } + $nbline = $limitsql; + } else { + $page = 0; + $limitsql = $nbline; + } } + //print $limitsql.'-'.$page.'-'.$viewline; // Onglets @@ -467,7 +472,7 @@ if ($id > 0 || ! empty($ref)) // VAT $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu2 ON bu2.fk_bank = b.rowid AND bu2.type='payment_vat'"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."tva as t ON bu2.url_id = t.rowid"; - + // Salary payment $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu3 ON bu3.fk_bank = b.rowid AND bu3.type='payment_salary'"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."payment_salary as sal ON bu3.url_id = sal.rowid"; diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index f0fca0b90ff..ae3038a6021 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -1,6 +1,7 @@ * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2014 Marcos García * * 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 @@ -22,6 +23,8 @@ > trans("ShowBill"),"bill").' '.$object->ref; ?> date,'day'); ?> - total_ht); ?> + rights->facture->lire) { + $total = $total + $object->total_ht; + echo price($object->total_ht); + } ?> getLibStatut(3); ?> total_ht; } ?> trans("TotalHT"); ?> - + rights->facture->lire) { + echo price($total); + } ?>   diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 53fa3b9c002..36b4af841a8 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1089,7 +1089,6 @@ abstract class CommonObject } } - /** * Save a new position (field rang) for details lines. * You can choose to set position for lines with already a position or lines without any position defined. diff --git a/htdocs/expedition/tpl/linkedobjectblock.tpl.php b/htdocs/expedition/tpl/linkedobjectblock.tpl.php index fd723650561..364afb92177 100644 --- a/htdocs/expedition/tpl/linkedobjectblock.tpl.php +++ b/htdocs/expedition/tpl/linkedobjectblock.tpl.php @@ -1,5 +1,6 @@ + * Copyright (C) 2014 Marcos García * * 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 @@ -21,6 +22,8 @@ id ?>">trans("ShowShipping"),"sending").' '.$object->ref; ?> date_creation,'day'); ?> date_delivery,'day'); ?> - total_ht); ?> + rights->expedition->lire) { + $total = $total + $object->total_ht; + echo price($object->total_ht); + } ?> getLibStatut(3); ?> total_ht; } ?> trans('TotalHT'); ?> - + rights->expedition->lire) { + echo price($total); + } ?>   diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index 627b2de0d84..0f70dc6bafc 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2014 Marcos García * * 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 @@ -55,6 +56,18 @@ class PaiementFourn extends Paiement // fk_paiement dans llx_paiement est l'id du type de paiement (7 pour CHQ, ...) // fk_paiement dans llx_paiement_facture est le rowid du paiement + /** + * Label of payment type + * @var string + */ + public $type_libelle; + + /** + * Code of Payment type + * @var string + */ + public $type_code; + /** * Constructor * @@ -74,7 +87,7 @@ class PaiementFourn extends Paiement function fetch($id) { $sql = 'SELECT p.rowid, p.datep as dp, p.amount, p.statut, p.fk_bank,'; - $sql.= ' c.libelle as paiement_type,'; + $sql.= ' c.code as paiement_code, c.libelle as paiement_type,'; $sql.= ' p.num_paiement, p.note, b.fk_account'; $sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiementfourn as p'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid '; @@ -95,6 +108,7 @@ class PaiementFourn extends Paiement $this->bank_line = $obj->fk_bank; $this->montant = $obj->amount; $this->note = $obj->note; + $this->type_code = $obj->paiement_code; $this->type_libelle = $obj->paiement_type; $this->statut = $obj->statut; $error = 1; diff --git a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php index d1e209eb54b..fc1942e0f61 100644 --- a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php @@ -1,5 +1,6 @@ + * Copyright (C) 2014 Marcos García * * 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 @@ -21,6 +22,8 @@ > trans("ShowOrder"),"order").' '.$object->ref; ?> date,'day'); ?> - total_ht); ?> + rights->fournisseur->commande->lire) { + $total = $total + $object->total_ht; + echo price($object->total_ht); + } ?> getLibStatut(3); ?> total_ht; } ?> trans('TotalHT'); ?> - + rights->fournisseur->commande->lire) { + echo price($total); + } ?>   diff --git a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php index ab585cc4b1f..c10fea8bb8a 100644 --- a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php @@ -1,5 +1,6 @@ + * Copyright (C) 2014 Marcos García * * 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 @@ -21,6 +22,8 @@ > trans("ShowBill"),"bill").' '.$object->ref; ?> date,'day'); ?> - total_ht); ?> + rights->fournisseur->facture->lire) { + $total = $total + $object->total_ht; + echo price($object->total_ht); + } ?> getLibStatut(3); ?> total_ht; } ?> trans("TotalHT"); ?> - + rights->fournisseur->facture->lire) { + echo price($total); + } ?>   diff --git a/htdocs/fourn/paiement/fiche.php b/htdocs/fourn/paiement/fiche.php index 9a38e16f7f4..0a2f3ad207f 100644 --- a/htdocs/fourn/paiement/fiche.php +++ b/htdocs/fourn/paiement/fiche.php @@ -2,7 +2,7 @@ /* Copyright (C) 2005 Rodolphe Quiedeville * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2006-2010 Laurent Destailleur - * Copyright (C) 2013 Marcos García + * Copyright (C) 2014 Marcos García * * 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 @@ -180,7 +180,8 @@ if ($result > 0) print ''; // Payment mode - print ''.$langs->trans('PaymentMode').''.$object->type_libelle.''; + $labeltype=$langs->trans("PaymentType".$object->type_code)!=("PaymentType".$object->type_code)?$langs->trans("PaymentType".$object->type_code):$object->type_libelle; + print ''.$langs->trans('PaymentMode').''.$labeltype.''; // Payment numero print ''.$form->editfieldkey("Numero",'num_paiement',$object->numero,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).''; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index c3b337c4a16..ebe96b8b485 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4,10 +4,16 @@ * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2007-2011 Jean Heimburger +<<<<<<< HEAD * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2013-2014 Cedric GROSS * Copyright (C) 2013 Marcos García * Copyright (C) 2011-2014 Alexandre Spangaro +======= + * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2013 Cedric GROSS + * Copyright (C) 2013-2014 Marcos García +>>>>>>> refs/remotes/origin/3.5 * * 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 @@ -602,7 +608,7 @@ class Product extends CommonObject foreach ($this->stock_warehouse as $idW => $ObjW) { $qty_batch = 0; - foreach ($ObjW->detail_batch as $detail) + foreach ($ObjW->detail_batch as $detail) { $qty_batch += $detail->qty; } @@ -615,12 +621,12 @@ class Product extends CommonObject $ObjBatch->qty = $ObjW->real - $qty_batch; $ObjBatch->fk_product_stock = $ObjW->id; if ($ObjBatch->create($user,1) < 0) - { + { $error++; $this->errors=$ObjBatch->errors; } } - } + } } // For automatic creation if ($this->barcode == -1) $this->barcode = $this->get_barcode($this,$this->barcode_type_code); @@ -994,6 +1000,62 @@ class Product extends CommonObject } } + /* + * Sets an accountancy code for a product. + * Also calls PRODUCT_MODIFY trigger when modified + * + * @param string $type It can be 'buy' or 'sell' + * @param string $value Accountancy code + * @return int <0 KO >0 OK + */ + public function setAccountancyCode($type, $value) + { + global $user, $langs, $conf; + + $this->db->begin(); + + if ($type == 'buy') { + $field = 'accountancy_code_buy'; + } elseif ($type == 'sell') { + $field = 'accountancy_code_sell'; + } else { + return -1; + } + + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET "; + $sql.= "$field = '".$this->db->escape($value)."'"; + $sql.= " WHERE rowid = ".$this->id; + + dol_syslog(get_class($this)."::".__FUNCTION__." sql=".$sql, LOG_DEBUG); + $resql = $this->db->query($sql); + + if ($resql) + { + // Call triggers + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('PRODUCT_MODIFY',$this,$user,$langs,$conf); + if ($result < 0) + { + $this->errors=$interface->errors; + $this->db->rollback(); + return -1; + } + // End call triggers + + $this->$field = $value; + + $this->db->commit(); + return 1; + } + else + { + $this->error=$this->db->lasterror(); + $this->db->rollback(); + return -1; + } + } + /** * Load array this->multilangs * @@ -1426,8 +1488,8 @@ class Product extends CommonObject $this->entity = $obj->entity; $this->db->free($resql); - - + + // Retreive all extrafield for thirdparty // fetch optionals attributes and labels require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); @@ -1794,7 +1856,7 @@ class Product extends CommonObject return -1; } } - + /** * Charge tableau des stats contrat pour le produit/service * @@ -2977,7 +3039,7 @@ class Product extends CommonObject function load_virtual_stock() { global $conf; - + if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) { $stock_commande_client=$stock_commande_fournisseur=0; @@ -3000,7 +3062,7 @@ class Product extends CommonObject $result=$this->load_stats_commande_fournisseur(0,'3'); if ($result < 0) dol_print_error($db,$this->error); $stock_commande_fournisseur=$this->stats_commande_fournisseur['qty']; - + $result=$this->load_stats_reception(0,'3'); if ($result < 0) dol_print_error($db,$this->error); $stock_reception_fournisseur=$this->stats_reception['qty']; diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index c1fc144e63d..a73d5817b3a 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -6,7 +6,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2006 Auguria SARL * Copyright (C) 2010-2014 Juanjo Menent - * Copyright (C) 2013 Marcos García + * Copyright (C) 2013-2014 Marcos García * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2011-2014 Alexandre Spangaro * Copyright (C) 2014 Cédric Gross @@ -145,20 +145,18 @@ if (empty($reshook)) } } - if ($action == 'setaccountancy_code_buy') - { - $result = $object->setValueFrom('accountancy_code_buy', GETPOST('accountancy_code_buy')); + if ($action == 'setaccountancy_code_buy') { + + $result = $object->setAccountancyCode('buy', GETPOST('accountancy_code_buy')); if ($result < 0) setEventMessage(join(',',$object->errors), 'errors'); - else $object->accountancy_code_buy=GETPOST('accountancy_code_buy'); $action=""; } if ($action == 'setaccountancy_code_sell') { - $result = $object->setValueFrom('accountancy_code_sell', GETPOST('accountancy_code_sell')); - if ($result < 0) setEventMessage(join(',',$object->errors), 'errors'); - else $object->accountancy_code_sell=GETPOST('accountancy_code_sell'); - $action=""; + $result = $object->setAccountancyCode('sell', GETPOST('accountancy_code_sell')); + if ($result < 0) setEventMessage(join(',',$object->errors), 'errors'); + $action=""; } // Add a product or service @@ -221,7 +219,7 @@ if (empty($reshook)) $object->barcode_type_code = $stdobject->barcode_type_code; $object->barcode_type_coder = $stdobject->barcode_type_coder; $object->barcode_type_label = $stdobject->barcode_type_label; - + $object->description = dol_htmlcleanlastbr(GETPOST('desc')); $object->url = GETPOST('url'); $object->note = dol_htmlcleanlastbr(GETPOST('note')); @@ -335,7 +333,7 @@ if (empty($reshook)) $object->barcode_type_code = $stdobject->barcode_type_code; $object->barcode_type_coder = $stdobject->barcode_type_coder; $object->barcode_type_label = $stdobject->barcode_type_label; - + $object->accountancy_code_sell = GETPOST('accountancy_code_sell'); $object->accountancy_code_buy = GETPOST('accountancy_code_buy'); @@ -1329,7 +1327,7 @@ else if (empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO)) $nblignes+=2; if ($object->isservice()) $nblignes++; else $nblignes+=4; - + // Photo if ($showphoto || $showbarcode) { @@ -1339,7 +1337,7 @@ else if ($showbarcode) print $form->showbarcode($object); print ''; } - + print ''; // Type @@ -1351,7 +1349,7 @@ else print $form->editfieldval("Type",'fk_product_type',$object->type,$object,$user->rights->produit->creer||$user->rights->service->creer,$typeformat); print ''; } - + if ($showbarcode) { // Barcode type diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 0392b073dd4..a6ecf470d38 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -160,14 +160,7 @@ if (empty($reshook)) $object->forme_juridique_code = GETPOST('forme_juridique_code'); $object->effectif_id = GETPOST('effectif_id'); - if (GETPOST("private") == 1) - { - $object->typent_id = dol_getIdFromCode($db,'TE_PRIVATE','c_typent'); - } - else - { - $object->typent_id = GETPOST('typent_id'); - } + $object->typent_id = GETPOST('typent_id'); $object->client = GETPOST('client'); $object->fournisseur = GETPOST('fournisseur');