From ba70c1a08a8793b773729e9e87e9444b5a64623b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 13 Sep 2014 20:47:34 +0200 Subject: [PATCH 01/11] Fix: typo on debian files --- build/debian/control | 8 ++++---- build/debian/get-orig-source.sh | 8 ++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/build/debian/control b/build/debian/control index f573f64b812..f4f9e12aa58 100755 --- a/build/debian/control +++ b/build/debian/control @@ -39,10 +39,10 @@ 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 are - visible, depending on which modules were activated. + Dolibarr was designed to be easy to use. Only the features that you need + are visible, depending on which modules were activated. . - Most common used modules are: + This is an example of most common used modules: . Customers, Suppliers or Prospects directory, Contacts directory, @@ -66,6 +66,6 @@ Description: Web based software to manage a company or foundation Wizards to export and import data, LDAP connectivity, PDF exports, - And a lot of more modules... + And a lot more modules... . You can also add third parties external modules or develop yours. 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 From 949ae2f160caf39293fd55918f31ca76c5a11c05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 14 Sep 2014 13:09:31 +0200 Subject: [PATCH 02/11] [ bug #1591 ] Linked object block shows Total HT/TTC even if not having permission to read them --- ChangeLog | 1 + .../comm/propal/tpl/linkedobjectblock.tpl.php | 17 +++++++++++++---- htdocs/commande/tpl/linkedobjectblock.tpl.php | 15 ++++++++++++--- .../facture/tpl/linkedobjectblock.tpl.php | 15 ++++++++++++--- htdocs/expedition/tpl/linkedobjectblock.tpl.php | 15 ++++++++++++--- .../commande/tpl/linkedobjectblock.tpl.php | 15 ++++++++++++--- .../fourn/facture/tpl/linkedobjectblock.tpl.php | 15 ++++++++++++--- 7 files changed, 74 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 04e63ec1c8e..575aa1aa0e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,6 +25,7 @@ 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 #1591 ] Linked object block shows Total HT/TTC even if not having permission to read them ***** ChangeLog for 3.5.4 compared to 3.5.3 ***** Fix: Hide title of event when agenda module disabled. 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/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/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/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); + } ?>   From 74e16db6321a27b4d064af12bb8ef8d2860c8cf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 14 Sep 2014 13:14:03 +0200 Subject: [PATCH 03/11] [ bug #1589 ] Menu type in "Edit menu" page is not translated --- ChangeLog | 1 + htdocs/admin/menus/edit.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 04e63ec1c8e..46efcc8492d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,6 +25,7 @@ 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 ***** ChangeLog for 3.5.4 compared to 3.5.3 ***** Fix: Hide title of event when agenda module disabled. diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index bf382be58ed..5c7d336c4a0 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 From afd631e6e3aa2d36b5af62fc30b0ac6e9d5a9321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 14 Sep 2014 13:22:05 +0200 Subject: [PATCH 04/11] [ bug #1577 ] When creating new Private individual third, selected third type is ignored --- ChangeLog | 1 + htdocs/societe/soc.php | 9 +-------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 04e63ec1c8e..878a1dcfa4f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,6 +25,7 @@ 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 #1577 ] When creating new Private individual third, selected third type is ignored ***** ChangeLog for 3.5.4 compared to 3.5.3 ***** Fix: Hide title of event when agenda module disabled. diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 0e2e58f73e8..b24179328fc 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -159,14 +159,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'); From 7a28f8e4aaf009ae5354565140abdc8d471d2dc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 14 Sep 2014 13:59:06 +0200 Subject: [PATCH 05/11] [ bug #1555 ] Update accountancy code of products does not throw PRODUCT_MODIFY trigger --- ChangeLog | 1 + htdocs/core/class/commonobject.class.php | 1 - htdocs/product/class/product.class.php | 55 +++++++++++++++++++++++- htdocs/product/fiche.php | 16 +++---- 4 files changed, 62 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 04e63ec1c8e..b277355b9d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,6 +25,7 @@ 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 #1555 ] Update accountancy code of products does not throw PRODUCT_MODIFY trigger ***** ChangeLog for 3.5.4 compared to 3.5.3 ***** Fix: Hide title of event when agenda module disabled. diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index dc2fe2888ad..6439e3e003e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1053,7 +1053,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/product/class/product.class.php b/htdocs/product/class/product.class.php index 52ad1a7f323..d7bdec82079 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2007-2011 Jean Heimburger * Copyright (C) 2010-2011 Juanjo Menent * Copyright (C) 2013 Cedric GROSS - * Copyright (C) 2013 Marcos García + * Copyright (C) 2013-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 @@ -796,6 +796,59 @@ class Product extends CommonObject return 1; } + /** + * 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) + { + $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) { + global $user, $langs, $conf; + + // 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 diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index d96aac8fc33..3c3d7ad8206 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-2011 Juanjo Menent - * Copyright (C) 2013 Marcos García + * Copyright (C) 2013-2014 Marcos García * Copyright (C) 2013 Cédric Salvador * * This program is free software; you can redistribute it and/or modify @@ -122,20 +122,18 @@ if (empty($reshook)) exit; } - 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 From 9426298b95db766c055bfb39f5e10ebb9990eac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 14 Sep 2014 14:19:46 +0200 Subject: [PATCH 06/11] [ bug #1548 ] Supplier payment card shows type in French --- ChangeLog | 1 + htdocs/fourn/class/paiementfourn.class.php | 16 +++++++++++++++- htdocs/fourn/paiement/fiche.php | 4 +++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 04e63ec1c8e..eee6f8a3136 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,6 +25,7 @@ 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 #1548 ] Supplier payment card shows type in French ***** ChangeLog for 3.5.4 compared to 3.5.3 ***** Fix: Hide title of event when agenda module disabled. diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index 380a16bd129..b8e9266cb37 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/paiement/fiche.php b/htdocs/fourn/paiement/fiche.php index 0cbceb917a0..97f8b331e65 100644 --- a/htdocs/fourn/paiement/fiche.php +++ b/htdocs/fourn/paiement/fiche.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005 Rodolphe Quiedeville * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2006-2010 Laurent Destailleur + * 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 @@ -187,7 +188,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).''; From 7bac9444e6ef77517905b231a2f81c13efd3d05d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 14 Sep 2014 14:32:17 +0200 Subject: [PATCH 07/11] [ bug #1546 ] Incorrect page number when searching in the list of bank transactions --- ChangeLog | 1 + htdocs/compta/bank/account.php | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 04e63ec1c8e..0f20be69f31 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,6 +25,7 @@ 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 #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/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 2cdda511bdb..e1d595aefcc 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 * * 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 @@ -253,17 +253,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 From d812262ed834a0c5813dd7ac3f31cf6d1dcf4e24 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 14 Sep 2014 21:52:52 +0200 Subject: [PATCH 08/11] Fix: Missing source --- .../plugins/tablednd/jquery.tablednd.0.6.js | 400 ++++++++++++++++++ 1 file changed, 400 insertions(+) create mode 100644 htdocs/includes/jquery/plugins/tablednd/jquery.tablednd.0.6.js diff --git a/htdocs/includes/jquery/plugins/tablednd/jquery.tablednd.0.6.js b/htdocs/includes/jquery/plugins/tablednd/jquery.tablednd.0.6.js new file mode 100644 index 00000000000..34f3c88232b --- /dev/null +++ b/htdocs/includes/jquery/plugins/tablednd/jquery.tablednd.0.6.js @@ -0,0 +1,400 @@ +/** + * TableDnD plug-in for JQuery, allows you to drag and drop table rows + * You can set up various options to control how the system will work + * Copyright (c) Denis Howlett + * Licensed like jQuery, see http://docs.jquery.com/License. + * + * Configuration options: + * + * onDragStyle + * This is the style that is assigned to the row during drag. There are limitations to the styles that can be + * associated with a row (such as you can't assign a border--well you can, but it won't be + * displayed). (So instead consider using onDragClass.) The CSS style to apply is specified as + * a map (as used in the jQuery css(...) function). + * onDropStyle + * This is the style that is assigned to the row when it is dropped. As for onDragStyle, there are limitations + * to what you can do. Also this replaces the original style, so again consider using onDragClass which + * is simply added and then removed on drop. + * onDragClass + * This class is added for the duration of the drag and then removed when the row is dropped. It is more + * flexible than using onDragStyle since it can be inherited by the row cells and other content. The default + * is class is tDnD_whileDrag. So to use the default, simply customise this CSS class in your + * stylesheet. + * onDrop + * Pass a function that will be called when the row is dropped. The function takes 2 parameters: the table + * and the row that was dropped. You can work out the new order of the rows by using + * table.rows. + * onDragStart + * Pass a function that will be called when the user starts dragging. The function takes 2 parameters: the + * table and the row which the user has started to drag. + * onAllowDrop + * Pass a function that will be called as a row is over another row. If the function returns true, allow + * dropping on that row, otherwise not. The function takes 2 parameters: the dragged row and the row under + * the cursor. It returns a boolean: true allows the drop, false doesn't allow it. + * scrollAmount + * This is the number of pixels to scroll if the user moves the mouse cursor to the top or bottom of the + * window. The page should automatically scroll up or down as appropriate (tested in IE6, IE7, Safari, FF2, + * FF3 beta + * dragHandle + * This is the name of a class that you assign to one or more cells in each row that is draggable. If you + * specify this class, then you are responsible for setting cursor: move in the CSS and only these cells + * will have the drag behaviour. If you do not specify a dragHandle, then you get the old behaviour where + * the whole row is draggable. + * + * Other ways to control behaviour: + * + * Add class="nodrop" to any rows for which you don't want to allow dropping, and class="nodrag" to any rows + * that you don't want to be draggable. + * + * Inside the onDrop method you can also call $.tableDnD.serialize() this returns a string of the form + * []=&[]= so that you can send this back to the server. The table must have + * an ID as must all the rows. + * + * Other methods: + * + * $("...").tableDnDUpdate() + * Will update all the matching tables, that is it will reapply the mousedown method to the rows (or handle cells). + * This is useful if you have updated the table rows using Ajax and you want to make the table draggable again. + * The table maintains the original configuration (so you don't have to specify it again). + * + * $("...").tableDnDSerialize() + * Will serialize and return the serialized string as above, but for each of the matching tables--so it can be + * called from anywhere and isn't dependent on the currentTable being set up correctly before calling + * + * Known problems: + * - Auto-scoll has some problems with IE7 (it scrolls even when it shouldn't), work-around: set scrollAmount to 0 + * + * Version 0.2: 2008-02-20 First public version + * Version 0.3: 2008-02-07 Added onDragStart option + * Made the scroll amount configurable (default is 5 as before) + * Version 0.4: 2008-03-15 Changed the noDrag/noDrop attributes to nodrag/nodrop classes + * Added onAllowDrop to control dropping + * Fixed a bug which meant that you couldn't set the scroll amount in both directions + * Added serialize method + * Version 0.5: 2008-05-16 Changed so that if you specify a dragHandle class it doesn't make the whole row + * draggable + * Improved the serialize method to use a default (and settable) regular expression. + * Added tableDnDupate() and tableDnDSerialize() to be called when you are outside the table + * Version 0.6: 2011-12-02 Added support for touch devices + */ +// Determine if this is a touch device +var hasTouch = 'ontouchstart' in document.documentElement, + startEvent = hasTouch ? 'touchstart' : 'mousedown', + moveEvent = hasTouch ? 'touchmove' : 'mousemove', + endEvent = hasTouch ? 'touchend' : 'mouseup'; + +jQuery.tableDnD = { + /** Keep hold of the current table being dragged */ + currentTable : null, + /** Keep hold of the current drag object if any */ + dragObject: null, + /** The current mouse offset */ + mouseOffset: null, + /** Remember the old value of Y so that we don't do too much processing */ + oldY: 0, + + + /** Actually build the structure */ + build: function(options) { + // Set up the defaults if any + + this.each(function() { + // This is bound to each matching table, set up the defaults and override with user options + this.tableDnDConfig = jQuery.extend({ + onDragStyle: null, + onDropStyle: null, + // Add in the default class for whileDragging + onDragClass: "tDnD_whileDrag", + onDrop: null, + onDragStart: null, + scrollAmount: 5, + + serializeRegexp: /[^\-]*$/, // The regular expression to use to trim row IDs + serializeParamName: null, // If you want to specify another parameter name instead of the table ID + dragHandle: null // If you give the name of a class here, then only Cells with this class will be draggable + }, options || {}); + // Now make the rows draggable + jQuery.tableDnD.makeDraggable(this); + }); + + // Don't break the chain + return this; + }, + + /** This function makes all the rows on the table draggable apart from those marked as "NoDrag" */ + makeDraggable: function(table) { + + var config = table.tableDnDConfig; + if (config.dragHandle) { + // We only need to add the event to the specified cells + var cells = jQuery("td."+table.tableDnDConfig.dragHandle, table); + cells.each(function() { + // The cell is bound to "this" + jQuery(this).bind(startEvent, function(ev) { + jQuery.tableDnD.initialiseDrag(this.parentNode, table, this, ev, config); + return false; + }); + }) + } else { + // For backwards compatibility, we add the event to the whole row + var rows = jQuery("tr", table); // get all the rows as a wrapped set + rows.each(function() { + // Iterate through each row, the row is bound to "this" + var row = jQuery(this); + if (! row.hasClass("nodrag")) { + row.bind(startEvent, function(ev) { + if (ev.target.tagName == "TD") { + jQuery.tableDnD.initialiseDrag(this, table, this, ev, config); + return false; + } + }).css("cursor", "move"); // Store the tableDnD object + } + }); + } + }, + + initialiseDrag: function(dragObject, table, target, evnt, config) { + jQuery.tableDnD.dragObject = dragObject; + jQuery.tableDnD.currentTable = table; + jQuery.tableDnD.mouseOffset = jQuery.tableDnD.getMouseOffset(target, evnt); + jQuery.tableDnD.originalOrder = jQuery.tableDnD.serialize(); + // Now we need to capture the mouse up and mouse move event + // We can use bind so that we don't interfere with other event handlers + jQuery(document) + .bind(moveEvent, jQuery.tableDnD.mousemove) + .bind(endEvent, jQuery.tableDnD.mouseup); + if (config.onDragStart) { + // Call the onDragStart method if there is one + config.onDragStart(table, target); + } + }, + + updateTables: function() { + this.each(function() { + // this is now bound to each matching table + if (this.tableDnDConfig) { + jQuery.tableDnD.makeDraggable(this); + } + }) + }, + + /** Get the mouse coordinates from the event (allowing for browser differences) */ + mouseCoords: function(ev){ + if(ev.pageX || ev.pageY){ + return {x:ev.pageX, y:ev.pageY}; + } + return { + x:ev.clientX + document.body.scrollLeft - document.body.clientLeft, + y:ev.clientY + document.body.scrollTop - document.body.clientTop + }; + }, + + /** Given a target element and a mouse event, get the mouse offset from that element. + To do this we need the element's position and the mouse position */ + getMouseOffset: function(target, ev) { + ev = ev || window.event; + + var docPos = this.getPosition(target); + var mousePos = this.mouseCoords(ev); + return {x:mousePos.x - docPos.x, y:mousePos.y - docPos.y}; + }, + + /** Get the position of an element by going up the DOM tree and adding up all the offsets */ + getPosition: function(e){ + var left = 0; + var top = 0; + /** Safari fix -- thanks to Luis Chato for this! */ + if (e.offsetHeight == 0) { + /** Safari 2 doesn't correctly grab the offsetTop of a table row + this is detailed here: + http://jacob.peargrove.com/blog/2006/technical/table-row-offsettop-bug-in-safari/ + the solution is likewise noted there, grab the offset of a table cell in the row - the firstChild. + note that firefox will return a text node as a first child, so designing a more thorough + solution may need to take that into account, for now this seems to work in firefox, safari, ie */ + e = e.firstChild; // a table cell + } + + while (e.offsetParent){ + left += e.offsetLeft; + top += e.offsetTop; + e = e.offsetParent; + } + + left += e.offsetLeft; + top += e.offsetTop; + + return {x:left, y:top}; + }, + + mousemove: function(ev) { + if (jQuery.tableDnD.dragObject == null) { + return; + } + if (ev.type == 'touchmove') { + // prevent touch device screen scrolling + event.preventDefault(); + } + + var dragObj = jQuery(jQuery.tableDnD.dragObject); + var config = jQuery.tableDnD.currentTable.tableDnDConfig; + var mousePos = jQuery.tableDnD.mouseCoords(ev); + var y = mousePos.y - jQuery.tableDnD.mouseOffset.y; + //auto scroll the window + var yOffset = window.pageYOffset; + if (document.all) { + // Windows version + //yOffset=document.body.scrollTop; + if (typeof document.compatMode != 'undefined' && + document.compatMode != 'BackCompat') { + yOffset = document.documentElement.scrollTop; + } + else if (typeof document.body != 'undefined') { + yOffset=document.body.scrollTop; + } + + } + + if (mousePos.y-yOffset < config.scrollAmount) { + window.scrollBy(0, -config.scrollAmount); + } else { + var windowHeight = window.innerHeight ? window.innerHeight + : document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight; + if (windowHeight-(mousePos.y-yOffset) < config.scrollAmount) { + window.scrollBy(0, config.scrollAmount); + } + } + + + if (y != jQuery.tableDnD.oldY) { + // work out if we're going up or down... + var movingDown = y > jQuery.tableDnD.oldY; + // update the old value + jQuery.tableDnD.oldY = y; + // update the style to show we're dragging + if (config.onDragClass) { + dragObj.addClass(config.onDragClass); + } else { + dragObj.css(config.onDragStyle); + } + // If we're over a row then move the dragged row to there so that the user sees the + // effect dynamically + var currentRow = jQuery.tableDnD.findDropTargetRow(dragObj, y); + if (currentRow) { + // TODO worry about what happens when there are multiple TBODIES + if (movingDown && jQuery.tableDnD.dragObject != currentRow) { + jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject, currentRow.nextSibling); + } else if (! movingDown && jQuery.tableDnD.dragObject != currentRow) { + jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject, currentRow); + } + } + } + + return false; + }, + + /** We're only worried about the y position really, because we can only move rows up and down */ + findDropTargetRow: function(draggedRow, y) { + var rows = jQuery.tableDnD.currentTable.rows; + for (var i=0; i rowY - rowHeight) && (y < (rowY + rowHeight))) { + // that's the row we're over + // If it's the same as the current row, ignore it + if (row == draggedRow) {return null;} + var config = jQuery.tableDnD.currentTable.tableDnDConfig; + if (config.onAllowDrop) { + if (config.onAllowDrop(draggedRow, row)) { + return row; + } else { + return null; + } + } else { + // If a row has nodrop class, then don't allow dropping (inspired by John Tarr and Famic) + var nodrop = jQuery(row).hasClass("nodrop"); + if (! nodrop) { + return row; + } else { + return null; + } + } + return row; + } + } + return null; + }, + + mouseup: function(e) { + if (jQuery.tableDnD.currentTable && jQuery.tableDnD.dragObject) { + // Unbind the event handlers + jQuery(document) + .unbind(moveEvent, jQuery.tableDnD.mousemove) + .unbind(endEvent, jQuery.tableDnD.mouseup); + var droppedRow = jQuery.tableDnD.dragObject; + var config = jQuery.tableDnD.currentTable.tableDnDConfig; + // If we have a dragObject, then we need to release it, + // The row will already have been moved to the right place so we just reset stuff + if (config.onDragClass) { + jQuery(droppedRow).removeClass(config.onDragClass); + } else { + jQuery(droppedRow).css(config.onDropStyle); + } + jQuery.tableDnD.dragObject = null; + var newOrder = jQuery.tableDnD.serialize(); + if (config.onDrop && (jQuery.tableDnD.originalOrder != newOrder)) { + // Call the onDrop method if there is one + config.onDrop(jQuery.tableDnD.currentTable, droppedRow); + } + jQuery.tableDnD.currentTable = null; // let go of the table too + } + }, + + serialize: function() { + if (jQuery.tableDnD.currentTable) { + return jQuery.tableDnD.serializeTable(jQuery.tableDnD.currentTable); + } else { + return "Error: No Table id set, you need to set an id on your table and every row"; + } + }, + + serializeTable: function(table) { + var result = ""; + var tableId = table.id; + var rows = table.rows; + for (var i=0; i 0) result += "&"; + var rowId = rows[i].id; + if (rowId && rowId && table.tableDnDConfig && table.tableDnDConfig.serializeRegexp) { + rowId = rowId.match(table.tableDnDConfig.serializeRegexp)[0]; + } + + result += tableId + '[]=' + rowId; + } + return result; + }, + + serializeTables: function() { + var result = ""; + this.each(function() { + // this is now bound to each matching table + result += jQuery.tableDnD.serializeTable(this); + }); + return result; + } + +}; + + +jQuery.fn.extend( + { + tableDnD : jQuery.tableDnD.build, + tableDnDUpdate : jQuery.tableDnD.updateTables, + tableDnDSerialize: jQuery.tableDnD.serializeTables + } +); \ No newline at end of file From 76ba3301c3041cca2c3cb1cbcdf8341b30aebb22 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 14 Sep 2014 22:34:17 +0200 Subject: [PATCH 09/11] Fix: Syntax for license key --- build/debian/copyright | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From fffb0f1bdeaa5602d971fa7a690a16cb9bfac04a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Sep 2014 20:23:04 +0200 Subject: [PATCH 10/11] Fix: bad translation key --- htdocs/product/reassort.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 4522304b887..d0b8c961afa 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -243,7 +243,7 @@ if ($resql) print_liste_field_titre($langs->trans("Ref"),"reassort.php", "p.ref",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),"reassort.php", "p.label",$param,"","",$sortfield,$sortorder); if (! empty($conf->service->enabled) && $type == 1) print_liste_field_titre($langs->trans("Duration"),"reassort.php", "p.duration",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("MininumStock"),"reassort.php", "p.seuil_stock_alerte",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("StockLimit"),"reassort.php", "p.seuil_stock_alerte",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DesiredStock"),"reassort.php", "p.desiredstock",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("PhysicalStock"),"reassort.php", "stock_physique",$param,"",'align="right"',$sortfield,$sortorder); // TODO Add info of running suppliers/customers orders From 9c70c2c3d0a7f04feb01aff2f7dfe35905d09dbc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Sep 2014 22:43:49 +0200 Subject: [PATCH 11/11] Fix: cents for indian ruppes are calle paisa and paise. --- ChangeLog | 1 + htdocs/langs/en_US/dict.lang | 2 ++ 2 files changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index c8238ac46c8..f94820c21cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,7 @@ For users: - Fix: Iban was used instead of Bic into SEPA file. - Fix: Must unaccent strings into SEPA file. - 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. ***** ChangeLog for 3.6 compared to 3.5.* ***** For users: diff --git a/htdocs/langs/en_US/dict.lang b/htdocs/langs/en_US/dict.lang index 4b724056147..bef1f4821b4 100644 --- a/htdocs/langs/en_US/dict.lang +++ b/htdocs/langs/en_US/dict.lang @@ -290,6 +290,8 @@ CurrencySingXOF=CFA Franc BCEAO CurrencyXPF=CFP Francs CurrencySingXPF=CFP Franc CurrencyCentSingEUR=cent +CurrencyCentINR=paisa +CurrencyCentSingINR=paise CurrencyThousandthSingTND=thousandth #### Input reasons ##### DemandReasonTypeSRC_INTE=Internet